I’m trying to create a new GameObject in C# and add a new animation to it. I get as far as “AddComponent()” 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.
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.