Reader small image

You're reading from  XR Development with Unity

Product typeBook
Published inNov 2023
Reading LevelBeginner
PublisherPackt
ISBN-139781805128120
Edition1st Edition
Languages
Tools
Right arrow
Authors (2):
Anna Braun
Anna Braun
author image
Anna Braun

Anna Braun is a Unity expert, who is specialized in creating XR applications. At Deutsche Telekom, Anna has developed XR prototypes in Unity. One prototype enabled warehouse workers to find commodities more easily through the use of special location data and Augmented Reality. At Fraunhofer, Anna specialized in Hand-Tracking and worked on a VR education platform. Her master's degree in Extended Reality has a special focus on Eye Tracking, Deep Learning, and Computer Graphics. She is a published author in the tech space and regularly speaks at conferences hosted by academia or non-profits like the Mozilla Foundation. Anna co-founded a company that offers XR consulting and development.
Read more about Anna Braun

Raffael Rizzo
Raffael Rizzo
author image
Raffael Rizzo

Raffael Rizzo is a XR developer and Unity expert. During his work at Deutsche Telekom, he consulted companies on the use of digital twins and implemented augmented reality wayfinding solutions. At Fraunhofer IGD, Raffael worked on a VR education platform. He developed a VR training program for a soccer academy to test the children's reaction times. For the same academy, Raffael created an application that uses computer vision and machine learning to automatically evaluate ball juggling. His master's degree in Extended Reality encompasses Rendering, Computer Vision, Machine Learning, and 3D Visualization. Raffael co-founded a company specializing in XR consulting and development.
Read more about Raffael Rizzo

View More author details
Right arrow

AR Development in Unity

In this chapter, we will immerse ourselves in the fascinating realm of AR development, from creating our first AR project in Unity to launching our first AR scene on a device or simulator. We will present to you numerous AR toolkits and plugins that Unity offers, and guide you in understanding their unique functionalities.

In a step-by-step manner, we will walk through the process of establishing an AR project in Unity, ensuring it is primed for smooth deployment onto any AR-supportive device.

This chapter will cover the following topics:

  • Understanding the AR landscape
  • Setting up an AR project in Unity using AR Foundation
  • Testing AR experiences directly in Unity
  • Deploying AR experiences onto mobile devices

Technical requirements

Before we dive into the practicality of the Unity Editor, it’s important to ensure your computer system is up to the task. Unity 2021.3 LTS, or a more recent version, is required to walk through the exercises that we’ll explore in this book. Check your hardware compatibility by comparing it with the system requirements provided on the Unity website at https://docs.unity3d.com/Manual/system-requirements.html.

As we’ll be exploring AR development in this chapter, we will need either an Android or iOS device capable of supporting ARKit or ARCore. Review whether your device meets these requirements at https://developers.google.com/ar/devices.

Understanding the AR landscape

As we start our exploration of AR, it’s crucial to first understand the foundational elements that enable this technology. How is it that our everyday devices can so effortlessly intertwine our physical reality with the digital? What mechanisms allow your device to sense, interpret, and interact with the world around it? And, perhaps most intriguingly, how can a simple screen transform into a doorway to an enhanced reality?

In this section, we aim to unpack the complex principles and mechanisms of AR, distilling them into a comprehensible format.

If terms such as AR, MR, and VR still seem opaque or interchangeable to you, consider revisiting Chapter 1 for clarification. For now, our focus remains on AR, which transforms our world by superimposing it with elements of the digital domain. Let’s look at the different types of experiences that AR offers.

What types of AR experiences exist?

The AR landscape is diverse, with experiences...

Setting up an AR project in Unity using AR Foundation

In this section, you will learn how to set up a simple AR project in Unity using AR Foundation. You will learn how you can place simple objects such as a cube, add plane detection functionalities, and implement touch inputs and anchors into your AR scenes.

Before using AR Foundation in our first AR application, however, we must first understand the architecture of this package.

Understanding AR Foundation’s architecture

In this section, we’ll delve into the exciting world of Unity’s AR Foundation, a package that empowers you to create AR experiences across various platforms. Whether you aim to create applications for Android, Apple, or HoloLens, AR Foundation simplifies the process remarkably. Its extensive capabilities range from plane detection, image and object tracking, and face and body tracking, to point clouds and more. Figure 4.1 breaks down the architecture of AR Foundation into a hierarchy...

Testing AR experiences directly in Unity

As of AR Foundation 5.0, developers can conveniently test AR scenes right in the Unity Editor using the XR Simulation feature, without the constant need to deploy on mobile devices. By the time you read this book, this feature might already be pre-installed. Let’s quickly check that by following these steps:

  1. Navigate to Edit | Project Settings.
  2. Choose XR Plug-in Management.
  3. Look for the XR Simulation option under Plug-in Providers and enable it.

If you don’t see the XR Simulation option, you’ll need to manually install AR Foundation 5.0 or a newer version. The next section explains how to do this.

Installing AR Foundation 5.0 or later versions and related packages

When you edit your project manifest, you control which package versions Unity loads into your project. There are two ways to edit your project manifest: add a package by name in Package Manager, or manually edit the project manifest...

Deploying AR experiences onto mobile devices

It’s now time to launch your AR experiences onto smartphones or tablets. Primarily, you have two paths to accomplish this: deployment onto an Android or an iOS device.

For solo projects, where the AR application is meant for personal use, you may opt to deploy onto just Android or iOS, depending on your device’s operating system. However, for larger-scale projects that involve several users – be it academic, industrial, or any other group, irrespective of its size – it’s advisable to deploy and test the AR app on both Android and iOS platforms.

This strategy has multiple benefits. First, if your application gains momentum or its usage expands, it would already be compatible with both major platforms, eliminating the need for time-consuming porting later on. Second, making your app accessible on both platforms from the outset can draw in more users, and possibly attract increased funding or support...

Summary

In this chapter, we’ve delved into the complexities and intricacies that surround AR glasses, exploring why these devices face numerous physical and technological challenges before they can be fully embraced by the public at large. We’ve examined the critical choice between marker-based and markerless approaches in your AR application, and we’ve discussed how this seemingly simple decision can significantly influence not only the development journey of your application but also its accessibility, versatility, and user engagement.

Through the exploration and installation of Unity’s AR Foundation package, you are now empowered to create simple AR experiences of your own, and ready to deploy them across an extensive array of handheld, AR-compatible mobile devices.

We’ve also discovered that the deployment of an AR scene onto iOS devices can be a complex and time-intensive task, largely due to the various restrictions imposed by Apple’...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
XR Development with Unity
Published in: Nov 2023Publisher: PacktISBN-13: 9781805128120
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Authors (2)

author image
Anna Braun

Anna Braun is a Unity expert, who is specialized in creating XR applications. At Deutsche Telekom, Anna has developed XR prototypes in Unity. One prototype enabled warehouse workers to find commodities more easily through the use of special location data and Augmented Reality. At Fraunhofer, Anna specialized in Hand-Tracking and worked on a VR education platform. Her master's degree in Extended Reality has a special focus on Eye Tracking, Deep Learning, and Computer Graphics. She is a published author in the tech space and regularly speaks at conferences hosted by academia or non-profits like the Mozilla Foundation. Anna co-founded a company that offers XR consulting and development.
Read more about Anna Braun

author image
Raffael Rizzo

Raffael Rizzo is a XR developer and Unity expert. During his work at Deutsche Telekom, he consulted companies on the use of digital twins and implemented augmented reality wayfinding solutions. At Fraunhofer IGD, Raffael worked on a VR education platform. He developed a VR training program for a soccer academy to test the children's reaction times. For the same academy, Raffael created an application that uses computer vision and machine learning to automatically evaluate ball juggling. His master's degree in Extended Reality encompasses Rendering, Computer Vision, Machine Learning, and 3D Visualization. Raffael co-founded a company specializing in XR consulting and development.
Read more about Raffael Rizzo