fix: Skip Vrm10Runtime instantiation after the GameObject is destroyed

This commit is contained in:
tsgcpp
2023-12-30 00:20:52 +09:00
parent e3d4ea53e8
commit f3e0e8e417

View File

@@ -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()