diff --git a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs index dd90a264af..005719eefc 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs @@ -119,27 +119,26 @@ internal Vrm10Runtime MakeRuntime(bool useControlRig) { if (m_springBoneRuntime == null) { - // シーン配置モデルが play された + // springbone が無い => シーン配置モデルが play されたと見做す var provider = GetComponent(); if (provider != null) { // 明示的カスタマイズ m_springBoneRuntime = provider.CreateSpringBoneRuntime(); } - else + + if (m_springBoneRuntime == null) { - // deafult に fallback - if (Application.isEditor) - { - m_springBoneRuntime = new Vrm10FastSpringboneRuntimeStandalone(); - } - else - { - m_springBoneRuntime = new Vrm10FastSpringboneRuntime(); - } + // シーン配置 play のデフォルトは singletone ではない方 + m_springBoneRuntime = new Vrm10FastSpringboneRuntimeStandalone(); } + m_springBoneRuntime.InitializeAsync(this, new ImmediateCaller()); } + else + { + // importer 内で InitializeAsync が呼び出し済み + } return new Vrm10Runtime(this, useControlRig, m_springBoneRuntime); } diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index c3c05ff387..3e920d2bd5 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -54,24 +54,27 @@ public Vrm10Importer( m_externalMap = new Dictionary(); } - m_springboneRuntime = MakeDefaultRuntime(springboneRuntime, isAssetImport); - } - - static IVrm10SpringBoneRuntime MakeDefaultRuntime(IVrm10SpringBoneRuntime runtime, bool isAssetImport) - { - if (runtime != null) + if (springboneRuntime == null) { - return runtime; - } - - if (isAssetImport) - { - // 何もしない dummy - return new Vrm10NopSpringboneRuntime(); + if (isAssetImport) + { + // 何もしない dummy + springboneRuntime = new Vrm10NopSpringboneRuntime(); + } + else + { + if (!Application.isPlaying) + { + // play中でない。test 対策 + springboneRuntime = new Vrm10FastSpringboneRuntimeStandalone(); + } + else + { + springboneRuntime = new Vrm10FastSpringboneRuntime(); + } + } } - - // Vrm10Instance.MakeRuntime に移譲 - return null; + m_springboneRuntime = springboneRuntime; } static void AssignHumanoid(List nodes, UniGLTF.Extensions.VRMC_vrm.HumanBone humanBone, VrmLib.HumanoidBones key)