Skip to content

Commit 2daaa92

Browse files
committed
Merge branch 'main' into merge-main-into-XRI3
2 parents 15787ae + 1be09dc commit 2daaa92

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

org.mixedrealitytoolkit.input/MRTK.Input.asmdef

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,26 @@
3535
"expression": "",
3636
"define": "GLTFAST_PRESENT"
3737
},
38+
{
39+
"name": "com.unity.cloud.gltfast",
40+
"expression": "6.11",
41+
"define": "GLTFAST_6_11_OR_NEWER"
42+
},
3843
{
3944
"name": "com.atteneder.gltfast",
4045
"expression": "",
4146
"define": "GLTFAST_PRESENT"
4247
},
48+
{
49+
"name": "com.atteneder.gltfast",
50+
"expression": "6.11",
51+
"define": "GLTFAST_6_11_OR_NEWER"
52+
},
53+
{
54+
"name": "com.atteneder.gltfast",
55+
"expression": "5",
56+
"define": "GLTFAST_5_0_OR_NEWER"
57+
},
4358
{
4459
"name": "com.unity.xr.management",
4560
"expression": "4.2",

org.mixedrealitytoolkit.input/Visualizers/ControllerVisualizer/ControllerModelLoader.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,21 @@ public async static Task<GameObject> TryGenerateControllerModelFromPlatformSDK(s
105105

106106
// Finally try to create a GameObject from the model data
107107
GltfImport gltf = new GltfImport();
108-
bool success = await gltf.LoadGltfBinary(modelStream);
109108
gltfGameObject = new GameObject(modelKey.ToString());
110-
if (success && await gltf.InstantiateMainSceneAsync(gltfGameObject.transform))
109+
110+
if (
111+
#if GLTFAST_6_11_OR_NEWER
112+
await gltf.Load(modelStream)
113+
#else
114+
await gltf.LoadGltfBinary(modelStream)
115+
#endif
116+
&&
117+
#if GLTFAST_5_0_OR_NEWER
118+
await gltf.InstantiateMainSceneAsync(gltfGameObject.transform)
119+
#else
120+
gltf.InstantiateMainScene(gltfGameObject.transform)
121+
#endif
122+
)
111123
{
112124
// After all the awaits, double check that another task didn't finish earlier
113125
if (controllerModelDictionary.TryGetValue(modelKey, out GameObject existingGameObject) && existingGameObject != null)

0 commit comments

Comments
 (0)