Reputation: 21
I'm currently having a problem with Unity Animator and I haven't found a solution yet. I'm trying to animate the position of a UI object through its Anchored Position with Unity Animator. Even though I have the checkbox Apply Root Motion active, when the animation ends it returns to its original position, instead of maintaining the position that changed. I activate the animations through Triggers in a Script, and all the Scripting logic works well. The expected behaviour would be like you can see in the gif, but moving through the connectors instead of turning back to its original cell.
I tried to make an Empty GO the parent and animate child, remake the animations, remake the animator, etc., but nothing worked so far and I don't know what to try next, and I could use some help.
Thanks for answering! I will answer anything necessary when asked!
Current State Gif:
Animator Screenshot:
Upvotes: 2
Views: 2228
Reputation: 1238
I can't be sure why your apply root motion
is not working as it should but you can fix this in another way.
You create 3 animations with the Anchor Position, one at the startpos, one for the transition from the first one to the end one, and the endpos.
Start animation and end animation should be looping while for the transitioning one you can uncheck the looping
in the inspector of animation
In the animator set the startpos as default state and create a transition with the trigger to the moving animation. Then add a transition from this animation to the idle end position without a condition but just has exit time
set of the time the last animation will play
In this way, it should all work fine and if you want to come back to the first position you can add another transition with a trigger to the start or whatever you prefer.
Upvotes: 1