Skip to content

Commit b5b4249

Browse files
committed
2.6.0b1 (sdk 1.11.11) - Adding Unity XR support, minor fixes
1 parent d2c991e commit b5b4249

32 files changed

+8213
-7479
lines changed

Assets/SteamVR/Editor/SteamVR_AutoEnableVR.cs

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ static SteamVR_AutoEnableVR()
2222

2323
protected const string openVRString = "OpenVR";
2424
protected const string openVRPackageString = "com.unity.xr.openvr.standalone";
25+
protected const string valveOpenVRPackageString = "com.valve.openvr";
26+
protected const string valveOpenVRGitURL = "https://github.com/ValveSoftware/steamvr_unity_plugin.git#UnityXRPlugin";
2527

2628
#if UNITY_2018_2_OR_NEWER
2729
private enum PackageStates
@@ -49,12 +51,21 @@ public static void Update()
4951
{
5052
bool enabledVR = false;
5153

54+
#if OPENVR_XR_API
55+
if (UnityEditor.PlayerSettings.virtualRealitySupported == true)
56+
{
57+
UnityEditor.PlayerSettings.virtualRealitySupported = false;
58+
enabledVR = true;
59+
Debug.Log("<b>[SteamVR Setup]</b> Disabled virtual reality support in Player Settings. <b>Because you're using XR Manager. Make sure OpenVR Loader is enabled in XR Manager UI.</b> (you can disable this by unchecking Assets/SteamVR/SteamVR_Settings.autoEnableVR)");
60+
}
61+
#else
5262
if (UnityEditor.PlayerSettings.virtualRealitySupported == false)
5363
{
5464
UnityEditor.PlayerSettings.virtualRealitySupported = true;
5565
enabledVR = true;
5666
Debug.Log("<b>[SteamVR Setup]</b> Enabled virtual reality support in Player Settings. (you can disable this by unchecking Assets/SteamVR/SteamVR_Settings.autoEnableVR)");
5767
}
68+
#endif
5869

5970
UnityEditor.BuildTargetGroup currentTarget = UnityEditor.EditorUserBuildSettings.selectedBuildTargetGroup;
6071

@@ -83,12 +94,17 @@ public static void Update()
8394
newDevices = devicesList.ToArray();
8495
}
8596

97+
98+
#if OPENVR_XR_API
99+
//UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(currentTarget, new string[] { });
100+
#else
86101
#if (UNITY_5_6 || UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
87102
UnityEditorInternal.VR.VREditor.SetVREnabledDevices(currentTarget, newDevices);
88103
#else
89104
UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(currentTarget, newDevices);
90105
#endif
91106
Debug.Log("<b>[SteamVR Setup]</b> Added OpenVR to supported VR SDKs list.");
107+
#endif
92108
}
93109

94110
#if UNITY_2018_2_OR_NEWER
@@ -111,12 +127,21 @@ public static void Update()
111127
break;
112128
}
113129

114-
bool hasPackage = listRequest.Result.Any(package => package.name == openVRPackageString);
130+
string packageName = openVRPackageString;
131+
#if OPENVR_XR_API
132+
UnityEditor.PackageManager.Client.Remove(openVRPackageString); //remove the old one or the dlls will clash
133+
134+
packageName = valveOpenVRPackageString;
135+
#elif UNITY_2020_1_OR_NEWER || XR_MGMT
136+
packageName = valveOpenVRGitURL;
137+
#endif
138+
139+
bool hasPackage = listRequest.Result.Any(package => package.name == packageName);
115140

116141
if (hasPackage == false)
117142
{
118143
//if we don't have the package - then install it
119-
addRequest = UnityEditor.PackageManager.Client.Add(openVRPackageString);
144+
addRequest = UnityEditor.PackageManager.Client.Add(packageName);
120145
packageState = PackageStates.WaitingForAdd;
121146
addTryCount++;
122147

@@ -180,14 +205,18 @@ public static void Update()
180205
packageState = PackageStates.Failed;
181206
break;
182207
}
208+
string packageName = openVRPackageString;
209+
#if OPENVR_XR_API
210+
packageName = valveOpenVRPackageString;
211+
#endif
183212

184-
bool hasPackage = listRequest.Result.Any(package => package.name == openVRPackageString);
213+
bool hasPackage = listRequest.Result.Any(package => package.name == packageName);
185214

186215
if (hasPackage == false)
187216
{
188217
if (addTryCount == 1)
189218
{
190-
addRequest = UnityEditor.PackageManager.Client.Add(openVRPackageString);
219+
addRequest = UnityEditor.PackageManager.Client.Add(packageName);
191220
packageState = PackageStates.WaitingForAdd;
192221
addTryCount++;
193222

@@ -223,7 +252,7 @@ public static void Update()
223252
}
224253
}
225254
#else
226-
UnityEditor.EditorApplication.update -= Update;
255+
UnityEditor.EditorApplication.update -= Update;
227256
#endif
228257
}
229258
}

Assets/SteamVR/Editor/SteamVR_Editor.asmdef

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"references": [
44
"SteamVR"
55
],
6-
"optionalUnityReferences": [],
76
"includePlatforms": [
87
"Editor"
98
],
@@ -12,5 +11,23 @@
1211
"overrideReferences": false,
1312
"precompiledReferences": [],
1413
"autoReferenced": true,
15-
"defineConstraints": []
14+
"defineConstraints": [],
15+
"versionDefines": [
16+
{
17+
"name": "com.valve.openvr",
18+
"expression": "",
19+
"define": "OPENVR_XR_API"
20+
},
21+
{
22+
"name": "com.unity.xr.management",
23+
"expression": "3.2.0",
24+
"define": "XR_MGMT_GTE_320"
25+
},
26+
{
27+
"name": "com.unity.xr.management",
28+
"expression": "",
29+
"define": "XR_MGMT"
30+
}
31+
],
32+
"noEngineReferences": false
1633
}

Assets/SteamVR/Extras/SteamVR_LaserPointer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ private void Start()
3232
if (pose == null)
3333
pose = this.GetComponent<SteamVR_Behaviour_Pose>();
3434
if (pose == null)
35-
Debug.LogError("No SteamVR_Behaviour_Pose component found on this object");
35+
Debug.LogError("No SteamVR_Behaviour_Pose component found on this object", this);
3636

3737
if (interactWithUI == null)
38-
Debug.LogError("No ui interaction action has been set on this component.");
38+
Debug.LogError("No ui interaction action has been set on this component.", this);
3939

4040

4141
holder = new GameObject();

Assets/SteamVR/Extras/SteamVR_LaserPointer.unity

Lines changed: 34 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ GameObject:
102102
- 135: {fileID: 24851823}
103103
- 23: {fileID: 24851822}
104104
- 54: {fileID: 24851821}
105-
- 114: {fileID: 24851826}
106105
m_Layer: 0
107106
m_Name: Sphere
108107
m_TagString: Untagged
@@ -186,47 +185,7 @@ Transform:
186185
m_Children: []
187186
m_Father: {fileID: 0}
188187
m_RootOrder: 3
189-
--- !u!114 &24851826
190-
MonoBehaviour:
191-
m_ObjectHideFlags: 0
192-
m_PrefabParentObject: {fileID: 0}
193-
m_PrefabInternal: {fileID: 0}
194-
m_GameObject: {fileID: 24851820}
195-
m_Enabled: 1
196-
m_EditorHideFlags: 0
197-
m_Script: {fileID: 11500000, guid: 23cd37f308d6fc040873615e9982a85e, type: 3}
198-
m_Name:
199-
m_EditorClassIdentifier:
200-
--- !u!21 &274413288
201-
Material:
202-
serializedVersion: 6
203-
m_ObjectHideFlags: 0
204-
m_PrefabParentObject: {fileID: 0}
205-
m_PrefabInternal: {fileID: 0}
206-
m_Name: Sprites/Default
207-
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
208-
m_ShaderKeywords:
209-
m_LightmapFlags: 5
210-
m_CustomRenderQueue: -1
211-
stringTagMap: {}
212-
m_SavedProperties:
213-
serializedVersion: 2
214-
m_TexEnvs:
215-
- first:
216-
name: _MainTex
217-
second:
218-
m_Texture: {fileID: 0}
219-
m_Scale: {x: 1, y: 1}
220-
m_Offset: {x: 0, y: 0}
221-
m_Floats:
222-
- first:
223-
name: PixelSnap
224-
second: 0
225-
m_Colors:
226-
- first:
227-
name: _Color
228-
second: {r: 1, g: 1, b: 1, a: 1}
229-
--- !u!43 &907364991
188+
--- !u!43 &33627688
230189
Mesh:
231190
m_ObjectHideFlags: 0
232191
m_PrefabParentObject: {fileID: 0}
@@ -354,6 +313,35 @@ Mesh:
354313
m_BakedConvexCollisionMesh:
355314
m_BakedTriangleCollisionMesh:
356315
m_MeshOptimized: 0
316+
--- !u!21 &1231479188
317+
Material:
318+
serializedVersion: 6
319+
m_ObjectHideFlags: 0
320+
m_PrefabParentObject: {fileID: 0}
321+
m_PrefabInternal: {fileID: 0}
322+
m_Name: Sprites/Default
323+
m_Shader: {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
324+
m_ShaderKeywords:
325+
m_LightmapFlags: 5
326+
m_CustomRenderQueue: -1
327+
stringTagMap: {}
328+
m_SavedProperties:
329+
serializedVersion: 2
330+
m_TexEnvs:
331+
- first:
332+
name: _MainTex
333+
second:
334+
m_Texture: {fileID: 0}
335+
m_Scale: {x: 1, y: 1}
336+
m_Offset: {x: 0, y: 0}
337+
m_Floats:
338+
- first:
339+
name: PixelSnap
340+
second: 0
341+
m_Colors:
342+
- first:
343+
name: _Color
344+
second: {r: 1, g: 1, b: 1, a: 1}
357345
--- !u!1001 &1474170597
358346
Prefab:
359347
m_ObjectHideFlags: 0
@@ -396,11 +384,11 @@ Prefab:
396384
- target: {fileID: 3380982, guid: 4d293c8e162f3874b982baadd71153d2, type: 2}
397385
propertyPath: m_Mesh
398386
value:
399-
objectReference: {fileID: 907364991}
387+
objectReference: {fileID: 33627688}
400388
- target: {fileID: 2348914, guid: 4d293c8e162f3874b982baadd71153d2, type: 2}
401389
propertyPath: m_Materials.Array.data[0]
402390
value:
403-
objectReference: {fileID: 274413288}
391+
objectReference: {fileID: 1231479188}
404392
m_RemovedComponents: []
405393
m_ParentPrefab: {fileID: 100100000, guid: 4d293c8e162f3874b982baadd71153d2, type: 2}
406394
m_IsPrefabParent: 0
@@ -424,9 +412,7 @@ MonoBehaviour:
424412
m_Name:
425413
m_EditorClassIdentifier:
426414
pose: {fileID: 0}
427-
interactWithUI:
428-
actionPath: /actions/default/in/InteractUI
429-
needsReinit: 0
415+
interactWithUI: {fileID: 11400000, guid: 4a1ec738249f25e4f824949a16c0b085, type: 2}
430416
active: 1
431417
color: {r: 0, g: 0, b: 0, a: 0}
432418
thickness: 0.002
@@ -447,9 +433,7 @@ MonoBehaviour:
447433
m_Name:
448434
m_EditorClassIdentifier:
449435
pose: {fileID: 0}
450-
interactWithUI:
451-
actionPath: /actions/default/in/InteractUI
452-
needsReinit: 0
436+
interactWithUI: {fileID: 11400000, guid: 4a1ec738249f25e4f824949a16c0b085, type: 2}
453437
active: 1
454438
color: {r: 0, g: 0, b: 0, a: 0}
455439
thickness: 0.002

Assets/SteamVR/Input/Editor/SteamVR_Skeleton_PoserEditor.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,16 @@ protected void DrawHand(bool showHand, SteamVR_Skeleton_Pose_Hand handData, Stea
252252
SteamVR_Skeleton_FingerExtensionTypes newMiddle = (SteamVR_Skeleton_FingerExtensionTypes)EditorGUILayout.EnumPopup("Middle movement", handData.middleFingerMovementType);
253253
SteamVR_Skeleton_FingerExtensionTypes newRing = (SteamVR_Skeleton_FingerExtensionTypes)EditorGUILayout.EnumPopup("Ring movement", handData.ringFingerMovementType);
254254
SteamVR_Skeleton_FingerExtensionTypes newPinky = (SteamVR_Skeleton_FingerExtensionTypes)EditorGUILayout.EnumPopup("Pinky movement", handData.pinkyFingerMovementType);
255-
EditorGUIUtility.labelWidth = 0;
256255

257256
EditorGUILayout.Space();
258257

259258
EditorGUILayout.PropertyField(showPreviewProperty);
259+
EditorGUIUtility.labelWidth = 0;
260260

261261
if (newThumb != handData.thumbFingerMovementType || newIndex != handData.indexFingerMovementType ||
262262
newMiddle != handData.middleFingerMovementType || newRing != handData.ringFingerMovementType ||
263263
newPinky != handData.pinkyFingerMovementType)
264264
{
265-
/*if ((int)newThumb >= 2 || (int)newIndex >= 2 || (int)newMiddle >= 2 || (int)newRing >= 2 || (int)newPinky >= 2)
266-
{
267-
Debug.LogError("<b>[SteamVR Input]</b> Unfortunately only Static and Free modes are supported in this beta.");
268-
return;
269-
}*/
270-
271265
handData.thumbFingerMovementType = newThumb;
272266
handData.indexFingerMovementType = newIndex;
273267
handData.middleFingerMovementType = newMiddle;

Assets/SteamVR/Input/ExampleJSON/actions.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@
122122
"controller_type": "vive_cosmos_controller",
123123
"binding_url": "bindings_vive_cosmos_controller.json"
124124
},
125+
{
126+
"controller_type": "logitech_stylus",
127+
"binding_url": "bindings_logitech_stylus.json"
128+
},
125129
{
126130
"controller_type": "vive_cosmos",
127131
"binding_url": "binding_vive_cosmos.json"
@@ -131,7 +135,7 @@
131135
"binding_url": "binding_vive.json"
132136
},
133137
{
134-
"controller_type": "index_hmd",
138+
"controller_type": "indexhmd",
135139
"binding_url": "binding_index_hmd.json"
136140
},
137141
{

Assets/SteamVR/Input/ExampleJSON/binding_index_hmd.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
]
2020
}
2121
},
22-
"controller_type": "index_hmd",
22+
"controller_type": "indexhmd",
2323
"description": "",
2424
"name": "index hmd defaults",
2525
"options": {},

0 commit comments

Comments
 (0)