fix: suppress ObjectReferenceFixer in play mode (#1336)

Not sure if this will do anything, but maybe it'll help with the perf issues people have reported?
This commit is contained in:
bd_ 2024-11-03 18:32:22 -08:00 committed by GitHub
parent 59ff119d20
commit 973e7d2448
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,10 +38,23 @@ namespace nadena.dev.modular_avatar.core
_context?.Invalidate?.Invoke();
}
};
EditorApplication.playModeStateChanged += state =>
{
if (state == PlayModeStateChange.EnteredEditMode)
{
EditorApplication.delayCall += ProcessObjectReferences;
}
};
}
private static void ProcessObjectReferences()
{
if (EditorApplication.isPlayingOrWillChangePlaymode)
{
_context = null;
return;
}
_lastStage = GetCurrentContentsRootId(out var contentsRoot);
AvatarObjectReference.InvalidateAll();