Closed drakeguo closed 3 months ago
That code looks like it should work fine. What does the Inspector look like?
normally, if I play the blend tree in the AnimatorController, there is a green bar indicating that the animation or AnimatorController is being played.
But when I try to play CartesianMixerState
created in script, or MixerTransition2D
created in inspector. there is no green bar, and the animation is not playing at all.
the character will fade into its T-Pose, without playing animation. then when you play another animation, it will fade into the new animation from this T-Pose. so it seems that the transition kind of works, but MixerState seems to be outputing a T-Pose instead of an animation.
Are you sure you're playing it and not just creating it? I can't think of any reason for that to not work, I have a bunch of unit tests which create mixers just like that.
If you can't figure it out, feel free to send a minimal reproduction project to animancer@kybernetik.com.au so I can take a look at it.
I found where the problem seems to be. Probably due to a bug in older version of Animancer. I have to call state?.RecreatePlayable()
for ControllerState
, otherwise the animation will not be played from its start. but if I called state?.RecreatePlayable()
for CartesianMixerState
it will freeze the animation. Not calling state?.RecreatePlayable()
solved my problem.
Thank you very much for the information.
I need to create a 2d Cartesian mixer that is equivalent to a blend tree in an animator controller in script. I tried to create a
CartesianMixerState
using code like thisthen I tried to play this
CartesianMixerState
usingAnimancerComponent.Play
but it didn't play the animations as I expected. I can see this state in the inspector window of AnimancerComponent. But it seemed this state is not playing at all.I saw there is a example of manually creating
LinearMixerState
and using it in the Documentation. I wonder ifCartesianMixerState
can be used in this way as well.Thanks.