1

I've made an animation on an Image object in my Unity game. When the animation has finished it animates back to its original position! I'd like to stop this from happening. I've tried Googling and searching here on SO but can't see any solutions so far! My animated object has an Animation and Animator components attached to it. The Animation component has an array of 3 animations. I only want to ensure one of them does not loop back to its default/original position.....

Here is a screenshot of the animation components attached the gameobject:

enter image description here

2 Answers 2

3

I suppose in the animation sequence the last frame is the same as the first frame? This is what usually happens and restores the animation to the original position. Try removing the "loop" tick of the animation as well as check the first and last frame.

12
  • OMG you solved the issue! The last frame was the same as the first frame! Duh! How do you preview the animation on an object before starting the game? I could preview the animation when making it but can't figure out how to to go back and re-play the animation after :S also, how can I make the animation go to another once it has finished? Would this be something I control within Animator?
    – Lloyd
    Aug 10, 2019 at 13:28
  • I've had a look in the Animator and set a transition between objects but that doesn't seem to do anything.... am I going about this the right way? How would you transition to another animation once one has finished?
    – Lloyd
    Aug 10, 2019 at 13:31
  • @Lloyd Click on the object that is already in your game hierarchy, if it has an animation press ctrl + 6 and it will open a new window. You will see the animation there and you can press the play button (in that new window) to see the animation playing in the scene. To go to another animation you will have to use animation transitions in the Animator.
    – Chochosan
    Aug 10, 2019 at 13:35
  • @Lloyd You will need to use keys/parameters in order to activate the transition. I suggest watching a video on the subject, try something like Unity animation transitions, there are plenty of informative tutorials out there.
    – Chochosan
    Aug 10, 2019 at 13:37
  • Thank you for your help. I've done ctrl+6, the animation window opens but no animation within it. When I click the game object it displays the animation and animator controller within it though. The animation plays in the game too. It's strange I can't preview the animation again with the method you said?
    – Lloyd
    Aug 10, 2019 at 13:46
0

I had the same issue, and I solved it just now. You must unchecked to Root Transform Position(XZ) / Bake Into Pose, from inside your animation.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.