fix: Animator can cache incorrect humanoid bone mappings (#431)

When multiple bones with the same name exist in the initial hierarchy, the root Animator
can cache (prior to MA execution) bones that will later be deleted or renamed due to MA
action. While this isn't persisted to the avatar asset bundle, it can result in validation failures
blocking upload. To resolve this, invalidate this cache late in MA execution.
This commit is contained in:
anatawa12 2023-09-14 19:28:49 +09:00 committed by GitHub
parent 29ca97e0c1
commit c8e535cd7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -223,6 +223,16 @@ namespace nadena.dev.modular_avatar.core.editor
new GCGameObjectsPass(context, avatarGameObject).OnPreprocessAvatar();
context.CommitReferencedAssets();
// workaround problem with avatar matching
// https://github.com/bdunderscore/modular-avatar/issues/430
var animator = avatarGameObject.GetComponent<Animator>();
if (animator) {
var avatar = animator.avatar;
animator.avatar = null;
// ReSharper disable once Unity.InefficientPropertyAccess
animator.avatar = avatar;
}
}
finally
{