Skip to content

Commit

Permalink
oculus quest 2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWitchBella committed Oct 8, 2021
1 parent 92d0d9c commit 936649e
Show file tree
Hide file tree
Showing 11 changed files with 363 additions and 19 deletions.
26 changes: 16 additions & 10 deletions Assets/Scripts/ScenePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,23 @@ bool HasVR()

public IEnumerator WaitForSelection()
{
Debug.Log("Press V to load into VR, or D to load into desktop mode");
bool v = false;
bool canHaveVR = Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor;
bool d = !canHaveVR;
while (!d && !v) {
v = Keyboard.current.vKey.isPressed;
d = Keyboard.current.dKey.isPressed;
yield return null;
if (Application.platform == RuntimePlatform.Android) {
// oculus quest
VREnabled = true;
} else {
// desktop
Debug.Log("Press V to load into VR, or D to load into desktop mode");
bool v = false;
bool canHaveVR = Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor;
bool d = !canHaveVR;
while (!d && !v) {
v = Keyboard.current.vKey.isPressed;
d = Keyboard.current.dKey.isPressed;
yield return null;
}
Debug.Log("V: " + (v ? "Yes" : "No") + " D: " + (d ? "Yes" : "No"));
VREnabled = v;
}
Debug.Log("V: " + (v ? "Yes" : "No") + " D: " + (d ? "Yes" : "No"));
VREnabled = v;

DontDestroyOnLoad(gameObject);
SceneManager.LoadScene(TargetScene, LoadSceneMode.Single);
Expand Down
14 changes: 14 additions & 0 deletions Assets/XR/Loaders/Oculus Loader.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 03bc68f14d65e7747a59d5ff74bd199b, type: 3}
m_Name: Oculus Loader
m_EditorClassIdentifier:
8 changes: 8 additions & 0 deletions Assets/XR/Loaders/Oculus Loader.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Assets/XR/Settings/Oculus Settings.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c353a8f1e58cf884584123914fe63cd5, type: 3}
m_Name: Oculus Settings
m_EditorClassIdentifier:
m_StereoRenderingModeDesktop: 0
m_StereoRenderingModeAndroid: 0
SharedDepthBuffer: 1
DashSupport: 1
V2Signing: 1
LowOverheadMode: 0
ProtectedContext: 0
FocusAware: 1
OptimizeBufferDiscards: 1
PhaseSync: 0
TargetQuest: 1
TargetQuest2: 1
8 changes: 8 additions & 0 deletions Assets/XR/Settings/Oculus Settings.asset.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

146 changes: 145 additions & 1 deletion Assets/XR/Settings/Open XR Package Settings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,26 @@ MonoBehaviour:
priority: 0
required: 0
ignoreValidationErrors: 0
--- !u!114 &-7134150529544542100
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f928d0d73a35f294fbe357ca17aa3547, type: 3}
m_Name: MicrosoftHandInteraction Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Microsoft Hand Interaction Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.handtracking
openxrExtensionStrings: XR_MSFT_hand_interaction
company: Unity
priority: 0
required: 0
--- !u!114 &-6749703287972430708
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -149,6 +169,26 @@ MonoBehaviour:
company: Unity
priority: 0
required: 0
--- !u!114 &-3192127390056703728
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b3cf79659a011bd419c7a2a30eb74e9a, type: 3}
m_Name: EyeGazeInteraction Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Eye Gaze Interaction Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.eyetracking
openxrExtensionStrings: XR_EXT_eye_gaze_interaction
company: Unity
priority: 0
required: 0
--- !u!114 &-2588708204206839614
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -181,9 +221,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9f0ebc320a151d3408ea1e9fce54d40e, type: 3}
m_Name: Open XR Package Settings
m_EditorClassIdentifier:
Keys: 01000000
Keys: 0100000007000000
Values:
- {fileID: -9158140485617597347}
- {fileID: 8017683119715235766}
--- !u!114 &2018971566220269911
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -244,6 +285,26 @@ MonoBehaviour:
company: Unity
priority: 0
required: 0
--- !u!114 &3079624461965913342
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 486b5e28864f9a94b979b9620ce5006d, type: 3}
m_Name: ConformanceAutomationFeature Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Conformance Automation
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.conformance
openxrExtensionStrings: XR_EXT_conformance_automation
company: Unity
priority: 0
required: 0
--- !u!114 &3945947549416922825
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -264,3 +325,86 @@ MonoBehaviour:
company: Unity
priority: 0
required: 0
--- !u!114 &4418956575029713908
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0f6bfdbcb316ed242b30a8798c9eb853, type: 3}
m_Name: KHRSimpleControllerProfile Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Khronos Simple Controller Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.khrsimpleprofile
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
--- !u!114 &5980844677358385182
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: feeef8d85de8db242bdda70cc7ff5acd, type: 3}
m_Name: OculusTouchControllerProfile Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Oculus Touch Controller Profile
version: 0.0.1
featureIdInternal: com.unity.openxr.feature.input.oculustouch
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
--- !u!114 &7557735188432756568
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 056125dd64c0ed540b40a4af74f7b495, type: 3}
m_Name: RuntimeDebuggerOpenXRFeature Android
m_EditorClassIdentifier:
m_enabled: 0
nameUi: Runtime Debugger
version: 1
featureIdInternal: com.unity.openxr.features.runtimedebugger
openxrExtensionStrings:
company: Unity
priority: 0
required: 0
cacheSize: 1048576
perThreadCacheSize: 51200
--- !u!114 &8017683119715235766
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b5a1f07dc5afe854f9f12a4194aca3fb, type: 3}
m_Name: Android
m_EditorClassIdentifier:
features:
- {fileID: 3079624461965913342}
- {fileID: -3192127390056703728}
- {fileID: 4418956575029713908}
- {fileID: -7134150529544542100}
- {fileID: 5980844677358385182}
- {fileID: 7557735188432756568}
m_renderMode: 1
m_depthSubmissionMode: 0
37 changes: 34 additions & 3 deletions Assets/XR/XRGeneralSettings.asset
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4696231038162322033
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d236b7d11115f2143951f1e14045df39, type: 3}
m_Name: Android Settings
m_EditorClassIdentifier:
m_LoaderManagerInstance: {fileID: 1600569177009845949}
m_InitManagerOnStart: 1
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -12,9 +26,27 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d2dc886499c26824283350fa532d087d, type: 3}
m_Name: XRGeneralSettings
m_EditorClassIdentifier:
Keys: 01000000
Keys: 0100000007000000
Values:
- {fileID: 3343092776531908358}
- {fileID: -4696231038162322033}
--- !u!114 &1600569177009845949
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4c3631f5e58749a59194e0cf6baf6d5, type: 3}
m_Name: Android Providers
m_EditorClassIdentifier:
m_RequiresSettingsUpdate: 0
m_AutomaticLoading: 0
m_AutomaticRunning: 0
m_Loaders:
- {fileID: 11400000, guid: 3885d3bb665e7904a977e11a820a2dd1, type: 2}
--- !u!114 &3343092776531908358
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -44,5 +76,4 @@ MonoBehaviour:
m_RequiresSettingsUpdate: 0
m_AutomaticLoading: 0
m_AutomaticRunning: 0
m_Loaders:
- {fileID: 11400000, guid: 8df8187c55c345e48b9e71bc916634f1, type: 2}
m_Loaders: []
1 change: 1 addition & 0 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"com.unity.ugui": "1.0.0",
"com.unity.xr.interaction.toolkit": "1.0.0-pre.3",
"com.unity.xr.management": "4.0.1",
"com.unity.xr.oculus": "1.9.1",
"com.unity.xr.openxr": "1.0.3",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Expand Down
10 changes: 10 additions & 0 deletions Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@
},
"url": "https://packages.unity.com"
},
"com.unity.xr.oculus": {
"version": "1.9.1",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.xr.management": "4.0.1",
"com.unity.ugui": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.xr.openxr": {
"version": "1.0.3",
"depth": 0,
Expand Down
1 change: 1 addition & 0 deletions ProjectSettings/EditorBuildSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ EditorBuildSettings:
path: Assets/Scenes/5 Credits.unity
guid: 5acf2b85062678e4c83cf22caff65f43
m_configObjects:
Unity.XR.Oculus.Settings: {fileID: 11400000, guid: 0ae063dbbf1182d48a24c8f1e0a3db13, type: 2}
com.unity.input.settings: {fileID: 11400000, guid: b868d74a109491f4aa3fb5a10861bba5, type: 2}
com.unity.xr.management.loader_settings: {fileID: 11400000, guid: 6c489be4d8e910a46a650000de9acf28, type: 2}
com.unity.xr.openxr.settings4: {fileID: 11400000, guid: 3cfee7ff73b24384b985375db19df9b7, type: 2}
Loading

0 comments on commit 936649e

Please sign in to comment.