diff --git a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs index c871b2650..50e95c47e 100644 --- a/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs +++ b/Assets/VRM10/Runtime/Components/Vrm10Instance/Vrm10Instance.cs @@ -95,6 +95,7 @@ namespace UniVRM10 { if (m_runtime == null) { + if (this == null) throw new MissingReferenceException("instance was destroyed"); m_runtime = new Vrm10Runtime(this, m_useControlRig); } return m_runtime; @@ -138,7 +139,11 @@ namespace UniVRM10 private void OnDestroy() { - Runtime.Dispose(); + if (m_runtime != null) + { + m_runtime.Dispose(); + m_runtime = null; + } } private void OnDrawGizmosSelected()