Closed ColorlessColor closed 2 months ago
Thanks, I hate it. 🤮
I'll try to repro and fix.
Hmm. I wasn't able to repro the issue with the steps given. That being said, I'll assume there's something else that's a necessary condition and switch to using SetEditorCurve as workaround.
I created a project for this if anyone needs it:
Reproed and changing to SetEditorCurve doesn't fix the issue :(
Only reproducible when entering play mode; building manually doesn't cause the issue. I think reload domain might need to be off as well...
Test Environment
Issue Description
Reproduction Steps
MA Merge Armature
. Assuming the Unity scene is as follows, with all GameObjects activated:AvatarRoot/ClothesUseMA/Armature/Hips/skirtPbRoot
(this is a float curve^1).AvatarRoot/ClothesUseMA/SkirtMesh
(this is an object reference curve^2).Unity Timeline
window.Play
button.MA Merge Armature
.Expected Behavior
AvatarRoot/ClothesUseMA/Armature/Hips/skirtPbRoot
should be rewritten and exist in the new animation clip.AvatarRoot/ClothesUseMA/SkirtMesh
should exist and its path should not be rewritten.Actual Behavior
AvatarRoot/ClothesUseMA/Armature/Hips/skirtPbRoot
is missing!AvatarRoot/ClothesUseMA/SkirtMesh
should exist and its path should not be rewritten.Possible Cause
https://github.com/bdunderscore/modular-avatar/blob/0806c621c5298fa2ec89d2590e8015f6a84fcf3a/Editor/Animation/PathMappings.cs#L248-L262
PathMappings.ApplyMappingsToClip
is used to rewrite animation clips' paths associated with GameObjects modified byMA Merge Armature
.The issue arises when
SetCurve
is first used to write float curves, followed immediately call aAnimationUtility.SetObjectReferenceCurve
. In the provided reproduction environment and steps, this results in all animation curves innewClip
being cleared (I really don't know why).The animation curve lost occurs only when the following conditions are met simultaneously:
Unity Timeline
window is exist.Play mode
.SetCurve
on the animation clip immediately followed byAnimationUtility.SetObjectReferenceCurve
, without any other method calls on the animation clip in between.The issue can be bypassed by the following methods:
Unity Timeline
window.AnimationUtility.SetEditorCurve
instead ofSetCurve
.AnimationUtility.GetCurveBindings
(or possibly other functions) on the animation clip betweenSetCurve
andAnimationUtility.SetObjectReferenceCurve
(note: even simply accessing or observing the animation clip's value in the debugger may cause the bug to disappear).Notes
This issue does not affect
Manual bake avatar
or uploading using theVRChat Avatar SDK
.The issue has only been verified on
Unity 2022.3.22f1
and has not been tested on any other versions. Only tested on my Unity installation (I tried reinstall it).I suspect this is an issue with Unity's animation system itself, and perhaps
Modular Avatar
does not need to address this specifically, but rather users should avoid usingUnity Timeline
.I chose to report this issue because I spent too much time on it and hope that this report will help users who encounter similar issues.