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

Preface

Hi there, and welcome to the exciting and ever-evolving world of Extended Reality (XR) development! If you’re feeling a mix of excitement and nervousness about diving into XR development in Unity for the first time, you’re not alone.

But don’t worry – the primary goal of this book is to make XR development accessible to everyone, regardless of prior experience. We’ll use simple language, provide vivid examples, and guide you through every step, from making objects grabbable to writing scripts in C# and incorporating hand-tracking into your scenes. You won’t even need access to a VR headset or AR-compatible smartphone to follow along; you can test most of the projects using simulators on your laptop or PC, ensuring accessibility for all.

In our own XR development journey, we’ve faced the frustration of spending endless hours trying to make a basic XR experience work. Now that we’ve gained extensive experience at notable companies such as Deutsche Telekom and academic institutions such as Fraunhofer IGD, we want to share our knowledge with you.

This book is not only a complete guide that will take you from being a novice in XR development or Unity to reaching an intermediate level in creating interactive XR applications for any domain. Its structure is also designed to help you easily access XR-related techniques to build outstanding XR applications, so you won’t need to constantly search online for answers, as we once did. Our goal is not to narrow your XR development expertise to specific use cases but to equip you with a wide array of tools so that you can bring any XR project to life, without limitations.

We’re thrilled to start on this journey with you!

Who this book is for

If you’re a student, professional, or just curious about venturing into VR, MR, or AR, this book is tailored for you. Whether you’re familiar with interactive media or just beginning, we will guide you through building XR applications in Unity with ease. No Unity experience? No problem. We cover the essentials, equipping you to develop interactive VR, MR, and AR projects.

What this book covers

Chapter 1, Introduction to XR and Unity, serves as a general introduction to the topic of XR development in Unity. This chapter explains which approaches exist to bring VR, MR, and AR to life. Furthermore, Unity’s role in XR development is introduced. The main goal of this chapter is to provide a good baseline to start learning how to build XR applications.

Chapter 2, The Unity Editor and Scene Creation, is aimed at those unfamiliar with Unity. It explains how to install Unity Hub and the Unity Editor and provides a step-by-step guide on how to create a basic scene in Unity. This chapter introduces fundamental concepts, from lighting and rendering to importing assets from the Unity Asset Store, equipping you with everything you need to know about the Unity Engine before diving into XR development.

Chapter 3, VR Development in Unity, presents the capabilities and components of the XR Interaction Toolkit and how to add it to a VR scene. After exploring the different types of interactions, from grabbing to climbing, this chapter explains how to test and deploy VR scenes to VR headsets or simulators, such as the XR Device Simulator.

Chapter 4, AR Development in Unity, explains how to create AR experiences in Unity using AR Foundation, ARKit, and ARCore. After building your first, simple AR application, this chapter focuses on testing this application directly on a PC, using XR simulation, and deploying it to Android and iOS devices.

Chapter 5, Building Interactive VR Experiences, explains how to add interactivity to a scene via animations, buttons events, or the programming language C#. Although this chapter teaches intermediate-level concepts, it is beginner-friendly and doesn’t require any preexisting knowledge of C#.

Chapter 6, Building Interactive AR Experiences, details how to create an interactive AR application, via touch controls and UI elements. Using the programming language C#, this chapter showcases how to build an AR experience that aligns with state-of-the-art design patterns and the core components of commercial AR applications.

Chapter 7, Adding Sound and Visual Effects, covers how to make XR scenes more immersive and realistic by mimicking physical phenomena from real life. This chapter explains the foundation of sound theory and particle behavior and highlights how both of these physical phenomena can be simulated in an XR environment with Unity. Through a hands-on project, this chapter explains how to add audio sources, audio mixers, and a particle system to an XR scene and how to fine-tune their properties, making them as realistic as possible.

Chapter 8, Building Advanced XR Techniques, introduces advanced XR techniques, elevating the overall user experience and immersion of any XR application. Specifically, this chapter details how to add hand-tracking or gaze-tracking support to VR applications via the XR Interaction Toolkit and explains how to build multiplayer experiences, where users can see each other via simple avatars and hand animations.

Chapter 9, Best Practices and Future Trends in XR Development, explores the current and future trends in XR technology. It provides insights into XR research and XR companies of various industries and introduces best practices along the entire XR development life cycle. To conclude this book, this chapter introduces additional toolkits and plugins for XR development. These resources are ideal for further exploration in future XR projects beyond what was covered in this book.

To get the most out of this book

If you don’t yet have Unity installed on your PC or laptop, don’t worry – we will guide you through this process in Chapter 2.

Software/hardware covered in the book

Operating system requirements

Unity version 2021.3.4 or later

Windows, macOS, or Linux

As you venture into creating immersive virtual, augmented, and mixed reality experiences, it’s crucial to set the foundation right. This starts by cloning the project repository using Git LFS. Even if you plan to build all projects from the ground up, it’s highly recommended to clone the entire repository. There will undoubtedly be sections where cross-referencing your progress with the actual solution will prove beneficial.

Attention

Do not simply download the repository in a ZIP format. Doing so will most likely result in errors upon opening. The correct approach is to clone it using Git LFS.

When working on virtual, augmented, and mixed reality projects in Unity, it’s common to handle large files – think 3D models, textures, audio clips, and more. Simply downloading a project might seem like a straightforward approach, but you may run into issues. The reason is rooted in how GitHub (and many other platforms) handle large files.

Let’s illustrate this with a simple analogy. Imagine you have a vast library of books. Instead of storing all these books at your home, which would take up enormous space, you get a reference card for each book. Whenever you want to read a particular book, you present the card at the library, and they provide the book for you.

Git LFS, which stands for Git Large File Storage, operates on a similar principle. Instead of saving bulky files directly within the repository, Git LFS maintains a tiny reference or “pointer.” The actual hefty files are stored elsewhere. Consequently, when you directly download a project without employing LFS, you only obtain these pointers, not the genuine files. To secure the entire content, you must clone the project with Git LFS.

The installation process for Git LFS and cloning our repository is very straightforward. Here’s a step-by-step guide:

  1. Install Git: If you have Windows, download Git from the Git for Windows website (https://gitforwindows.org/), and follow the installation instructions. For macOS, you can either download Git from the official website (https://git-scm.com/download/mac) or simply use brew install git in your Terminal if you have Homebrew. For Linux, use your package manager, such as sudo apt-get install git for Debian-based distributions.
  2. Setting up Git: Open your Terminal or Command Prompt. Configure your username with git config --global user.name "Your Name". Configure your email with git config --global user.email "youremail@example.com".
  3. Install Git LFS: Visit the official Git LFS website (https://git-lfs.com/) and follow their installation instructions.
  4. Initialize Git LFS: In your Terminal or Command Prompt, type git lfs install. This sets up Git LFS for your user account.
  5. Sign up for GitHub: If you haven’t already, create a free account on GitHub (https://git-lfs.com/).
  6. Clone the Repository: Navigate to the directory where you want to clone the project. Open your Terminal. Use the git clone https://github.com/PacktPublishing/XR-Development-with-Unity.git command.

That’s it! You’re now ready to work with the Git repository and Git LFS to manage large files.

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Downloading the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/XR-Development-with-Unity. If there’s an update to the code, it will be updated in the GitHub repository. Do remember to clone using Git LFS, as described previously, instead of simply downloading the repository in a ZIP format. Doing so will ensure that there are no errors upon opening.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Additional Resources

The demo videos of the projects created in this book are available in the GitHub repository: https://github.com/PacktPublishing/XR-Development-with-Unity/tree/main/Additional%20Resources

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Our final step is to override the Update() function.”

A block of code is set as follows:

private void Update()
{
float scaleValue = slider.value;
bus.transform.localScale = new Vector3(scaleValue, scaleValue, scaleValue);
}

Any command-line input or output is written as follows:

$ mkdir css
$ cd css

Bold: Indicates a new term, an important word, or words that you see on screen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Within Unity Hub, navigate to the Installs tab and hit the Add button, to add a new Unity Editor version.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read XR Development with Unity, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781805128120

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
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 £13.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