diff --git a/Assets/VRM/UniGLTF/Scripts/IO/ImporterContext.cs b/Assets/VRM/UniGLTF/Scripts/IO/ImporterContext.cs index bf7aa7394..8c975612b 100644 --- a/Assets/VRM/UniGLTF/Scripts/IO/ImporterContext.cs +++ b/Assets/VRM/UniGLTF/Scripts/IO/ImporterContext.cs @@ -586,10 +586,10 @@ namespace UniGLTF AnimationImporter.ImportAnimation(this); } }) + .ContinueWithCoroutine(Scheduler.MainThread, OnLoadModel) .ContinueWith(Scheduler.CurrentThread, _ => { - OnLoadModel(); if (m_showSpeedLog) { Debug.Log(GetSpeedLog()); @@ -598,9 +598,10 @@ namespace UniGLTF }); } - protected virtual void OnLoadModel() + protected virtual IEnumerator OnLoadModel() { Root.name = "GLTF"; + yield break; } IEnumerator TexturesProcessOnAnyThread() diff --git a/Assets/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs b/Assets/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs index 362dc7b16..a0cddf0b4 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/VRMImporterContext.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UniGLTF; using UnityEngine; using System.IO; - +using System.Collections; namespace VRM { @@ -39,7 +39,7 @@ namespace VRM } #region OnLoad - protected override void OnLoadModel() + protected override IEnumerator OnLoadModel() { Root.name = "VRM"; @@ -47,21 +47,27 @@ namespace VRM { LoadMeta(); } + yield return null; using (MeasureTime("VRM LoadHumanoid")) { LoadHumanoid(); } + yield return null; using (MeasureTime("VRM LoadBlendShapeMaster")) { LoadBlendShapeMaster(); } + yield return null; + using (MeasureTime("VRM LoadSecondary")) { VRMSpringUtility.LoadSecondary(Root.transform, Nodes, GLTF.extensions.VRM.secondaryAnimation); } + yield return null; + using (MeasureTime("VRM LoadFirstPerson")) { LoadFirstPerson();