Difference between revisions of "Set up VR in Unity"

From Interaction Station Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
<br/>
 
<br/>
 
'''Setting up VR and XR interaction toolkit project in Unity for versions 2019.4,2020.x & 2021.1'''<br/>
 
'''Setting up VR and XR interaction toolkit project in Unity for versions 2019.4,2020.x & 2021.1'''<br/>
1. Install XR plugin management:
+
 
edit / project settings / xr plugin management / install xr pluging management
+
'''1. Install XR plugin management:'''<br/>
<br/><br/>
+
edit / project settings / xr plugin management / install xr pluging management<br/>
 +
 
 
[[File:01_project_settings.png|200px]]<br/><br/>
 
[[File:01_project_settings.png|200px]]<br/><br/>
 
[[File:02_xr_plugin_management.png|400px]]<br/>
 
[[File:02_xr_plugin_management.png|400px]]<br/>
 
<br/>
 
<br/>
  
2. Add Oculus to the plugin providers:<br/>
+
'''2. Add Oculus to the plugin providers:'''<br/>
 
tick the Oclus box (if using oculus) open xr if using others
 
tick the Oclus box (if using oculus) open xr if using others
 
<br/>
 
<br/>
Line 15: Line 16:
 
[[File:04_open_xr_playmode.png|400px]]<br/>
 
[[File:04_open_xr_playmode.png|400px]]<br/>
  
3. Enable the Interaction Profile for Oculus:<br/>  
+
'''3. Enable the Interaction Profile for Oculus:'''<br/>  
 
[[File:05_xr_interaction_profile.png|400px]]  
 
[[File:05_xr_interaction_profile.png|400px]]  
  
4.Enable preview Packages in the Package Manager:<br/>
+
'''4.Enable preview Packages in the Package Manager:'''<br/>
 
Window / Package Manager<br/>
 
Window / Package Manager<br/>
 
[[File:07_xr_packagemanager.png|400px]]<br/>
 
[[File:07_xr_packagemanager.png|400px]]<br/>
Line 29: Line 30:
  
  
4.In the package Manager install "XR Interaction Toolkit *.*.*-pre*" (whatever the latest version is)
+
'''5.In the package Manager install "XR Interaction Toolkit":'''<br/>
at the top left of the package manager select Packages: Unity Registry
+
at the top left of the package manager select Packages: Unity Registry<br/>
expand XR Interaction Toolkit and click see other versions
+
 
click install in the lower right corner of the package manager
+
[[File:08_xr_unity_registry.png|400px]]<br/>
<br/>
+
Find and select XR interaction Toolkit<br/>
4B. In the XR interaction Toolkit package / samples
+
click install in the lower right corner of the package manager<br/>
Download and import the Default Input Actions
+
[[File:09_xr_xr_interactiontoolkit.png|400px]]
 
<br/>
 
<br/>
 +
 +
'''5b. In the XR Interaction Toolkit Package samples, install the Default Input Actions:'''<br/>
 +
Download and import the Default Input Actions<br/>
 +
[[File:10_xr_samples_default_input_actions.png|400px]]<br/>
 +
 +
 +
 +
 
5. In the Project tab under assets
 
5. In the Project tab under assets
 
Assets / Samples /  XR interaction toolkit / 1.... / Default Input Actions /
 
Assets / Samples /  XR interaction toolkit / 1.... / Default Input Actions /

Revision as of 14:41, 19 January 2022


Setting up VR and XR interaction toolkit project in Unity for versions 2019.4,2020.x & 2021.1

1. Install XR plugin management:
edit / project settings / xr plugin management / install xr pluging management

01 project settings.png

02 xr plugin management.png

2. Add Oculus to the plugin providers:
tick the Oclus box (if using oculus) open xr if using others
03 open xr plugin.png
Choose your PlayMode Open XR Runtime
04 open xr playmode.png

3. Enable the Interaction Profile for Oculus:
05 xr interaction profile.png

4.Enable preview Packages in the Package Manager:
Window / Package Manager
07 xr packagemanager.png
in the package manager click on the gear and choose "advanced project settings"
under "Advanced Settings" tick on "Enable Preview Packages"

06 xr advanced package settings.png
07 xr enable prerelease.png


5.In the package Manager install "XR Interaction Toolkit":
at the top left of the package manager select Packages: Unity Registry

08 xr unity registry.png
Find and select XR interaction Toolkit
click install in the lower right corner of the package manager
09 xr xr interactiontoolkit.png

5b. In the XR Interaction Toolkit Package samples, install the Default Input Actions:
Download and import the Default Input Actions
10 xr samples default input actions.png



5. In the Project tab under assets Assets / Samples / XR interaction toolkit / 1.... / Default Input Actions / select "XRI Default Left Controller" - In the inspector click "Add to ActionBasedController default" same for right
6. edit / project / settings / preset manager / under Action Based Controller in the filter add "left" to the filter for "XRI Default left Controller" "right" to the filter for "XRI Default right Controller"
7.now you can add an XR Rig - Action Based to your project Game Object / XR / XR Rig Action Based
8.On the XR rig Game Object in the inspector add a component called "Input Action Manager" in the component under "Action Assets" change the number to 1 and expand click on the dot to select "XRI default input actions"
9. You may have to enable the following setting: "Window/Analysis/Input Debugger/Options/Lock Input to Game View"