Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Windows MR loading model code #178

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Assets/NewtonVR/WindowsMR/NVRWindowsMRInput.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
Expand All @@ -12,6 +13,7 @@
using GLTF;
using UnityEngine.XR.WSA.Input;
using HoloToolkit.Unity;
using UnityGLTF;

#if !UNITY_EDITOR
using Windows.Foundation;
Expand Down Expand Up @@ -207,12 +209,12 @@ private IEnumerator LoadSourceControllerModel(InteractionSource source)
#endif

RenderModel = new GameObject { name = source.handedness + "-glTFController" };
GLTFComponentStreamingAssets gltfScript = RenderModel.AddComponent<GLTFComponentStreamingAssets>();
gltfScript.ColorMaterial = GLTFMaterial;
gltfScript.NoColorMaterial = GLTFMaterial;
gltfScript.GLTFData = fileBytes;
GLTFComponent gltfScript = RenderModel.AddComponent<GLTFComponent>();
gltfScript.GLTFConstant = gltfScript.GLTFStandard = gltfScript.GLTFStandardSpecular = GLTFMaterial.shader;
gltfScript.UseStream = true;
gltfScript.GLTFStream = new MemoryStream(fileBytes);

yield return gltfScript.LoadModel();
yield return gltfScript.WaitForModelLoad();

RenderModelInitialized = true;
loading = false;
Expand Down