Installing Unity
To get started, you first need to install Unity on your development machine. All the projects in this book will be built using the Unity 3D game engine. Unity is a powerful, cross-platform 3D development environment with a user-friendly editor.
If you don't have Unity installed on your computer yet, we'll do that now! The full-featured Personal Edition is free and runs on both Windows and Mac (for details, see https://store.unity.com/#plans-individual). This book is written with Unity 2019.4 LTS and Unity 2020.x in mind.
Development system requirements
There are a few prerequisites that we need before we get started. You should have a Mac or Windows PC to develop on with enough resources to install and run Unity (a Linux version of Unity is also in the works). Details of the current system requirements for Unity can be found on its website (https://unity3d.com/unity/system-requirements), including the supported operating system versions, the graphics card, or built-in GPU, sufficient disk space, and necessary RAM.
For VR development, we recommend that you have a physical device that you are targeting for the build applications, compatible with the Software Development Kit (SDK) that you are using with Unity. That may be an Android mobile VR, such as Oculus Quest, or a Windows-based HMD, such as Oculus Rift, HTC Vive, Windows IMR (from Acer, HP, and so on), or the other VR device supported by Unity.
Installing Unity Hub
Unity Hub is a convenient desktop application for managing all your Unity projects and installed versions, and is a portal to Unity's own plethora of learning content. It is not uncommon to create a project using one version of Unity, and then at a later date start another project with a newer version of Unity. I recommend using Unity Hub for managing your Unity installs and projects (https://docs.unity3d.com/Manual/GettingStartedUnityHub.html).
For existing projects, hold back on updating Unity to a newer version until you've scheduled time to address possible compatibility issues that might be introduced with the upgrade. This is especially recommended with projects that are nearing release. Unity Hub is a convenient tool for managing your Unity projects and associated installed versions.
If you don't have Unity Hub installed on your development machine, do it now by going through the following steps:
- Browse to the Unity Store Unity Personal download page at https://store.unity.com/download.
- Download and install Unity Hub.
- Sign in to your Unity account or Create one if you do not have an account.
Now we can install Unity itself.
Installing the Unity Editor
The next step is installing the Unity Editor itself, and at the same time, the modules that are needed for you to build your target platforms. To install Unity, go through the following steps:
- Within Unity Hub, choose Installs in the left-hand menu tabs.
- Select the ADD button to open the Add Unity Version dialog box, and choose the current version of Unity, 2019 or later.
- Select Next to select the optional modules that you also want to install.
- If you're targeting Android devices, check the Android Build Support module, as well as the corresponding tools (you may need to unfold the list with the arrow icon), as shown in the following screenshot.
- Then select NEXT.
- If prompted, accept any additional license terms and the download will begin:
Now we're ready to create our first project.
Creating a new Unity project
Let's create a new Unity project named VR_is_Awesome, or whatever you'd like:
- In Unity Hub, choose Projects in the left-hand menu tabs.
- Select the NEW button (in the top-right) to start a new project (note that the NEW button includes a dropdown list for selecting an installed Unity version other than your default).
- In the Create New Project dialog box, you will be prompted to choose a Template. For the projects in this book, we will use the Universal Render Pipeline. Select Universal Render Pipeline.
- Enter a project name, such as VR_is_awesome. You can also select its location in your filesystem.
- Select CREATE to create a new empty project and open the Unity Editor on your desktop.
A Create New Project dialog box is shown in the following screenshot:
Unity Hub gives you the option to choose a template when creating a new Unity project. The projects in this book will use the Universal Render Pipeline (formerly called the Lightweight Render Pipeline). If you are aiming for high-end graphics quality, you may decide to use the High-Definition Render Pipeline (HDRP) in your own projects instead.
Installing additional packages and assets
Once you create and open a specific Unity project, there may be more packages and assets that you want or need to install. Unity provides several avenues for extending its features, platform support, editor tools, and runtime assets:
- Package Manager: Use the Unity Package Manager (in Unity's top menu., go to Window | Package Manager) to view which packages are available for installation or are already installed in your Project (https://docs.unity3d.com/Manual/upm-ui.html).
- Import Unity Package: You can import asset package files (filename extension .unitypackage) from the menu Assets | Import Package—for example, packages can be exported from another project and shared via Assets | Export Package.
- Import Asset: You can import individual assets that are created with another app or downloaded from the web with Assets | Import New Asset, or simply drag and drop a file into the Project window in Unity.
We'll use all of these mechanisms at one time or another later in this chapter and throughout this book.
The Unity Asset Store, available through your web browser, is home to a growing library of free and commercial assets created both by Unity Technologies and members of the community. Learn more at https://unity3d.com/quick-guide-to-unity-asset-store. Assets you may have purchased (or got for free) on the store can be installed using the Open In Unity button on the web page, and also as a package listed in the Package Manager.
With a new project, it's always a good idea to open thePackage Managerand review what's already installed in your project, so let's do that now:
- Select Window | Package Manager.
- By default, the filter is set to In Project.
- You may notice that from time to time, newer updates to your packages will become available. With appropriate caution, you should update. Especially with point releases, these updates should only be bug fixes rather than potentially breaking features.
- To add a package, you need to find uninstalled packages. Change the filter dropdown to All Packages to see all packages, including those not yet installed in your project.
The following image shows a Package Manager window where several packages have updates available:
Now that you have Unity installed on your development machine, let's explore how to use the Unity Editor.