Search Unity

Question I'm Very Confused About Creating New Animations via C#

Discussion in 'Animation' started by DockAnkh, Dec 9, 2022.

  1. DockAnkh

    DockAnkh

    Joined:
    Nov 25, 2021
    Posts:
    10
    I'm trying to create a new GameObject in C# and add a new animation to it. I get as far as "AddComponent<Animator>()" but then I'm not sure what to do. All the advice I can find is about doing this to an existing object in the Unity GUI. I have a sprite sheet but I don't know how to create a animation controller and animation in C#. It also doesn't look like you can create an animation in Unity without it being attached to a GameObject already.
     
  2. Noodle_Meanie

    Noodle_Meanie

    Joined:
    Sep 11, 2021
    Posts:
    110
    Get rid of what you've done as of right now. To get an animator in c#, you do "public Animator myAnimator" the name myAnimator can be changed. Then to make the animations, I recommend you look at Brackey's video for it:
    . While this is for movement, it teaches you how to activate animations. Ask me if you need any help with this.