modular-avatar
modular-avatar copied to clipboard
MA Parameters may destroy persistent assets indirectly referenced from MA MergeAnimator
... when conditions below are met:
ModularAvatarMergeAnimatorcomponent is added by NDMF plugin before MA pass,ModularAvatarMergeAnimator.animatoris set to a temporary AnimatorController (new AnimatorController()),- the AnimatorController is populated with references from persistent assets,
( e.g.
maMergeAnimator.animator.layers = existingAnimatorControllerAsset.layers.Where(SomeLogic).ToArray()) - and the parameters in the merged animation are renamed by
ModularAvatarParameters.
Analysis
AnimatorController itself is temporary asset (so not deep cloned), but the data it contains is not.
Workaround
- Deep copy animator layers, instead of populating
ModularAvatarMergeAnimator.animatorwith references from persistent assets. - Alternatively, do not rename parameters ( set
internalParameter = false).