Virtual Reality with Unity
4.5 (4 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
65 students enrolled

Virtual Reality with Unity

Build effective, realistic, and exciting Virtual Reality games in Unity 3D
4.5 (4 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
65 students enrolled
Created by Packt Publishing
Last updated 2/2020
Current price: $86.99 Original price: $124.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 5.5 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Concepts and components of the Unity Engine and Editor and how to set up a project ready for VR
  • Create a User Interface (UI) and game menu and build Interactions with C# scripting
  • Learn VR elements and build a state machine through Unity's Animator
  • Learn how to design an effective and solid virtual reality experience
  • Achieve a stable framerate
  • Master the tools and techniques you'll need for optimal VR performance.
  • Learn the use of universal UX concept and some specific rules for VR design using Unity
  • Use optimization techniques to achieve optimal VR performance
Course content
Expand all 39 lectures 05:32:53
+ Unity3D Engine Overview and Project Setup
6 lectures 18:04

This video will give you an overview about the course.

Preview 05:09

To get started with our project, we first need to install Unity Hub.

   •  Go to Unity’s website

   •  Then choose the correct version of Unity Hub to install

   •  Once opened, setup the correct license and install Unity proper

Installing Unity Hub

Now that we have Unity Hub, we can install Unity proper.

   •  In Unity Hub, go to the Installs section

   •  Select the version of Unity to install

   •  Wait for the installation to complete

Installing the Unity Editor

Next, we need to create a project to be able to work with.

   •  In Unity Hub, go to the projects section

   •  Add a new project with the proper version and settings

   •  Wait for the project to be created

Creating a New Project

For those who haven’t used Unity before, it’s a good idea to have a foundation on what sections of the editor there are.

   •  With Unity opened, look at the project window

   •  Then see how the scene view works

   •  Finally understand how the hierarchy and inspector can be used

Overview of Unity Interface

Before we start building the project, let’s see what we are going to accomplish over the course.

   •  Start off by seeing the UI menus

   •  Then look at the gameplay

   •  Finally note the level design and lighting

Project Overview
Test your knowledge
5 questions
+ Designing an Effective and Solid Virtual Reality Experience
3 lectures 13:21

To understand how virtual reality can be used, let’s see some of the ways it has been used in the past.

   •  First, we will discuss how VR is used for training

   •  Then learn about the education and healthcare/medical uses

   •  Talk about construction, fitness, games, and more

Preview 05:20

In this video, we discuss the current Virtual Reality Landscape and the differences between the main devices used.

   •  First, we discuss the difference between standalone and tethered headsets

   •  We discuss standalone headsets

   •  Then we discuss tethered ones

Virtual Reality Landscape and the Differences Between the Main Devices

When building VR projects for multiple types of devices we must understand the differences in how they handle FOV.

   •  We first discuss how the concept of FOV

   •  Then we talk about how humans normally see

   •  We visualize the most common VR devices and their FOVs

How Users See in Virtual Reality
Test your knowledge
5 questions
+ Building Basic VR Interactions
5 lectures 30:43

To begin our VR project, we first need to make sure our project has the correct settings applied for VR development.

   •  First, we need to modify the Player Project Settings

   •  Then we need to use the package manager

   •  From there, we need to install some of our VR SDKs

Setup for VR Development

To speed up for VR development, we will make use of the virtual reality toolkit (VRTK for short). In this video, we shall install it.

   •  Go to the asset store

   •  Install VRTK

   •  Download the correct SDKs for other platforms

Installing VRTK

Before creating the final levels for our game, we will first create a testbed in order to develop our game’s mechanics.

   •  Identify the required objects for the testbed

   •  Bring in our SDK Manager to our level

   •  Set up aliases for our controllers

Creating a Testbed Level

In order to select objects and see things, pointers can be useful. In this video, we discuss how they can be added to controllers and how they can be rendered to a screen.

   •  First, we will discuss the pointer components

   •  We will then add pointer components

   •  Customize the pointer renderers

Emitting Pointers

Being able to get around environments is very important in VR. One of the most common ways this is done is through a teleporting mechanic.

   •  Discuss the different types of teleporting

   •  Then we see them in action

   •  Then we put them in our testbed

Implementing a Teleport System
Test your knowledge
5 questions
+ Creating Weapons
5 lectures 37:17

In this video, we start the creation of our game’s gun by first looking at an example and the building our own version.

   •  We will see an example for a gun in VRTK

   •  Bring in our testbed

   •  Update our atlases to work with it

Creating the Gun Prefab

Since our player will always be holding the weapon. In this video, we see how to make that possible.

   •  Discuss the reasoning to automatically pick up the gun

   •  Use the VRTK_Object Auto Grab Component to spawn our weapon

   •  Then we will prevent the player from dropping it

Automatically Pick Up the Weapon

While it is fine for a prototype, it’s important to have a model for our weapons. In this video, we see how to do just that.

   •  Use the Asset Store to find a weapon to use

   •  Replace the original model with our new one

   •  We adjust the bullet spawning to adjust to the new object

Customizing the Weapon’s Appearance

Instead of just shooting, we also add visual effects in the form of a custom animation and muzzle flash effects.

   •  Examine the original shooting script

   •  Create our own child class using inheritance

   •  Add custom animation and muzzle flash effects

Extending Gun Behavior with C# and Inheritance

In addition to visuals in this video, we shall use haptic feedback and sound to add realism to our weapon.

   •  Find sound assets to use with our gun

   •  Utilize the VRTK_InteractHaptics options

   •  Add sound upon firing weapon

Implementing Sound and Haptic Feedback
Test your knowledge
5 questions
+ Developing an Enemy AI
5 lectures 01:04:40

To provide a challenge to our player we will implement a simple enemy. In this video, we find a model and bring it into our game.

   •  Find a model for our enemy

   •  Bring the enemy into our project

   •  Then we setup the character to have an idle animation

Overview of an Enemy AI

Next, we discuss Unity’s collision system and how we can use it to damage and defeat our enemy.

   •  Create a new Zombie behavior script

   •  Enable the ability to respond to collisions

   •  Have the enemy take random damage and get defeated

Damaging the Enemy

A still enemy is not very exciting. To provide even more feedback to our player, we will look at Unity’s Animator system and how to transition from different animation states.

   •  Explore Unity’s Animator window

   •  Discover the usage for Animator parameters and state transitions

   •  Play different animations depending on stimuli

Animating the Enemy

Continuing with the thought of states, we implement the state machine design pattern for our enemy’s brains. With that we utilize Unity’s NavMesh system to move enemies to our player.

   •  Implement the state machine pattern utilizing enums and coroutines

   •  Utilize the NavMeshAgent to make the enemy come to the player

   •  Transition from one state to another depending on stimuli

Enemy Movement Using NavMeshes and State Machines

To even the playing field, we let the enemy have a melee attack. Here, we discuss how to utilize Animation Events to have our animation and attack match each other.

   •  Have the enemy rotate to face the player

   •  Have the enemy stop when it is close to the player

   •  Implement a melee attack on the player with Animation Events

Implementing the Enemy Attack State
Test your knowledge
5 questions
+ Building Levels for VR
5 lectures 01:10:07

To build levels quickly we will utilize ProBuilder. In this video, we bring it into our project.

   •  Open the Package Manager

   •  Install ProBuilder

   •  Open the ProBuilder menu

Importing ProBuilder

Here, we see how we can quickly implement a level layout and adjust it using ProBuilder.

   •  Create a room by flipping normals

   •  Create a room with additive and subtractive geometry

   •  Create multiple rooms and a path between them

Greyboxing a Level with ProBuilder

After finishing the level being built, we see how we can polish the scene using materials on the walls.

   •  Bring in materials and textures to the project

   •  Utilize the UV editor to apply materials to walls

   •  Modify object UVs to move and scale walls to fit effectively

Applying Textures to Environments

To finish up the scene we use lighting to bring the world to life.

   •  Use point lights to add lightbulb like visuals

   •  Utilize directional lights and update environmental lighting

   •  Set up a spotlight for a flashlight

Effectively Lighting Your Scene

Another useful aspect of level design is making use of triggers which will allow designers to craft gameplay elements when players enter a certain area. Here, we see how that can be done in VR.

   •  Add a box collider with the Is Trigger property

   •  Implement a trigger spawner behavior

   •  Detect collision with trigger and a VR headset

Using Triggers for Gameplay Effects
Test your knowledge
5 questions
+ Creating the User Interface and Game Menus
5 lectures 55:55

One of the most important aspects to know when developing UI in Unity is how to work in various spaces. Here, we discuss them and how to get the effects of both in VR space.

   •  Discuss Overlay UI

   •  Discuss World-Space UI

   •  Discover UI design lessons for VR

Overlay UI versus World Space

In this video, we discover how to create a UI element inside of VR space and how to have it follow the gun object.

   •  Add a canvas within World Space

   •  Add a text object into the canvas

   •  Adjust the text object and add an outline to it

Displaying Information via Text

Having UI on the screen is one thing and having it do something is another. In this video, we discover how to update UI elements through code.

   •  Update the Handgun script to store references to UI objects

   •  Modify text at runtime through code

   •  Add a reloading mechanic to the game

Updating UI Elements Through Code

Another key UI in games is a main menu. Here, we learn how to build one as well as how to use buttons in VR.

   •  Create a secondary scene to hold our main menu

   •  Add a new UI canvas with text and button

   •  Utilize the VRTK_UI pointer to use UI elements in a VR environment

Building the Main Menu

In this video, we implement the transition from the main menu into the game proper.

   •  Implement behavior to switch scenes

   •  Modify button on Click events

   •  Update the build settings menu to load multiple scenes

Scripting UI Interactions
Test your knowledge
5 questions
+ Optimization Techniques
5 lectures 42:46

Before we can optimize our game, we need to know some of the tools we can look at to learn where our game is slowing down. In this video, we look at both the Stats menu as well as the Profiler and see how they can be used.

   •  Explore the Stats menu and its uses

   •  Open the Profiler menu and explore how it is used

   •  Utilize the Hierarchy mode to see what is using the most CPU time

Introducing the Rendering Statistics Menu and Profiler

A tool that can be used to optimize a game is the concept of Texture atlases where you have multiple objects share the same texture. In this video, we see how it can be used.

   •  Discover what a Texture atlas is and what it is used for

   •  Install the Texture atlas creator for Unity

   •  Build a Texture atlas for scene props

Creating a Texture Atlas

Another option is having objects switch out with less detailed objects when they’re further from the camera. In Unity, this can be done with LOD Groups which we will use here.

   •  Open Blender and import prop models

   •  Utilize the Decimate modifier to simplify props

   •  Set up LOD Groups to blend between props

Optimizing Mesh Polycounts with Blender and LOD Groups

An even better way of saving computations is not even rendering something if it doesn’t need to be drawn. This can be done through the process of occlusion culling.

   •  Discuss culling and its usage

   •  Utilize Static properties for culling

   •  Visualize the occlusion culling in the scene

Occlusion Culling

Finally, we touch on the ability to save our lighting information in light maps for a runtime performance boost.

   •  Change lighting mode to be baked

   •  Open the Lighting settings menu

   •  Bake the scene lightmaps and disable Global Illumination

Bake Lighting
Test your knowledge
5 questions
  • Programmers or game developers who have a basic knowledge of Virtual Reality and want to explore what Unity has to offer will also find it useful. Knowledge of C# is required.

If want to know how to build the most vivid and realistic games using Unity, this is the perfect tutorial.

Virtual Reality is an exploding market and there is still a lot to discover about it. Unity 2019 is an intuitive multiplatform game engine that has become the industry standard for building Virtual Reality games, applications, and experiences for the new generation of consumer VR devices.

In this course, you will learn about the specifics of Virtual Reality development in Unity. You will learn how to intuitive VR user interfaces and integrate audio and video into your application to give a lasting impression. You will build practical solutions to some of the key issues facing Virtual Reality with helpful tips for making better VR experiences.

By the end of this course, you will have learned how to create a VR game using Unity 3D and implement some of the most common and useful interactions and game mechanics. You will also know how to think in VR and create a comfortable and effective user experience.

Please note that this course uses Unity 2019 and assumes prior working knowledge of Unity; however, those who have migrated to Unity 2020 will still benefit from the features and project deployment covered in this course. Please also note that knowledge of C# is also required for this course.

Programmers or game developers who have a basic knowledge of Virtual Reality and want to explore what Unity has to offer will also find it useful.

About the Author

John P. Doran is a passionate and seasoned technical game designer, software engineer, and author based in Peoria, Illinois. His passion for game development began at an early age. He later graduated from DigiPen Institute of Technology with a Bachelor of Science degree in Game Design.

For over a decade, John has gained extensive hands-on expertise in game development by working in various roles, ranging from game designer to lead UI programmer. He has worked in teams ranging from just himself to over 70 people in student, mod, and professional game projects (including working at LucasArts on Star Wars: 1313). Additionally, John has worked in game development education, teaching in Singapore, South Korea, and the United States. To date, he has authored over 15 books on game development.

John is currently an Instructor in Residence at Bradley University. In an earlier incarnation, he was an award-winning videographer.

Who this course is for:
  • This course is for Unity Game developers who are beginning to work on Virtual Reality projects.