Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Animations not working after every restart of unity

Discussion in 'Getting Started' started by pavlovskimichael, Sep 29, 2019.

  1. pavlovskimichael

    pavlovskimichael

    Joined:
    Sep 14, 2019
    Posts:
    2
    Hi,
    I just started working with unity and I use a udemy tutorial to learn unity.
    How I've created the animation:
    • created a Player - GameObject in the scene
    • added an animation (PlayerIdle.anim) in the Animation - Tab
    • added one image to the animation (created out of a sprite sheet)
    Then I start the game the animation works. After closing unity and reopening the project the animation-tab is completly empty (Player - GameObject is selected in the Hierarchy), but the animation-files are still in the directory I've saved them to.

    What I've tried so far:
    • Created only the animation-file without adding any image to it. Animation is still lost after restart.
    • Saved the anim - Files in different directions (Assets/Sprites/Player/, Assets/Animations/). Animation is still lost after restart.
    • Deleted the whole project and cloned it again from GitHub. Animation is lost after opening the project but the anim - file is there.
    I found out that everytime I restart unity it creates a new Player.controller file. So there is a Player.controller, Player 2.controller and so on but the Player - gameobject is still named Player in the inspector.

    I'm totaly confused about that behavior.

    Thank you for any help in advance. I don't know which file I should upload, please tell me if a file is needed.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,266
    The animation tab shows you the animations associated with the currently selected object. So it's not significant that it's empty when you restart; that just means you no longer have things selected that you did before, or that you didn't save your scene and lost some of your changes at the scene level.

    So be sure to save your scene, and take careful note of all the inspection-related properties: the animator controller on the player object, the animation on that animator controller, which animation is selected in the Animation tab, etc. Don't just take in the big picture; look at all the tiny details. They matter.

    Incidentally, if you're doing 2D animation, then Unity's animation system is not necessarily the best way to do it. Check out my article 2D Animation Methods in Unity for some simpler alternatives.
     
  3. pavlovskimichael

    pavlovskimichael

    Joined:
    Sep 14, 2019
    Posts:
    2
    As I had already written, I have selected the Player - GameObject after restarting unity. Also there is only 1 scene in the Hierarchy and I saved it before closing with ctrl + S (There was no * next to the name of the scene).