Merge pull request #2212 from tsgcpp/feature/skip_vrm10instance_instantiation

Vrm10Instance生成後に非アクティブにしてそのままOnDestroy()が実施された場合にエラーとなる問題の対策
This commit is contained in:
ousttrue 2024-01-09 13:54:59 +09:00 committed by GitHub
commit bbff2fa095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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