Book Image

XR Development with Unity

By : Anna Braun, Raffael Rizzo
2 (1)
Book Image

XR Development with Unity

2 (1)
By: Anna Braun, Raffael Rizzo

Overview of this book

The drastic surge in the demand for XR development has led to an imminent need for comprehensive resources, learning material, and overall know-how in this area. This one-stop resource will ensure that professionals venturing into XR development can access all XR-related techniques to build appealing XR applications, without relying on Google every step of the way. This book is your guide to developing XR applications with Unity 2021.3 or later versions, helping you to create VR, AR, and MR experiences of increasing complexity. The chapters cover the entire XR application development process from setting up an interactive XR scene using the XR Interaction Toolkit or AR Foundation, adding physics, animations, continuous movement, teleportation, sound effects, and visual effects, to testing and deploying to VR headsets, simulators, smartphones, and tablets. Additionally, this XR book takes you on a journey from the basics of Unity and C# to advanced techniques such as building multiplayer applications and incorporating hand- and gaze-tracking capabilities. By the end of this book, you'll be fully equipped to create cutting-edge XR projects for engaging individual, academic, and industrial use cases that captivate your audience.
Table of Contents (15 chapters)
Free Chapter
Part 1 – Understanding the Basics of XR and Unity
Part 2 – Interactive XR Applications with Custom Logic, Animations, Physics, Sound, and Visual Effects
Part 3 – Advanced XR Techniques: Hand-Tracking, Gaze-Tracking, and Multiplayer Capabilities

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.


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 (, and follow the installation instructions. For macOS, you can either download Git from the official website ( 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 "Your Name". Configure your email with git config --global "[email protected]".
  3. Install Git LFS: Visit the official Git LFS website ( 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 (
  6. Clone the Repository: Navigate to the directory where you want to clone the project. Open your Terminal. Use the git clone 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.