< Back to Game Dev, Unity

Animating in Unity

This example is to make a constant animation loop endlessly (say a shining sun animation).

The first thing you need is a spritesheet which is basically all the animation frames in 1 image. I usually do this in Flash. When you’re done, drag the spritesheet image into Unity. In the Inspector change ‘Sprite Mode’ to ‘Multiple’. Then a ‘Sprite Editor’ button will appear.

When the Sprite Editor is opened, it’s time to slice up the spritesheet into individual images. Select ‘Slice’ in the top left corner and for the type choose ‘Grid’ for frame by frame animation which is what I usually do. Put in the pixel size that each of your sprites are then hit ‘slice’ and then ‘apply’ in the top right to save your changes.

Now, select the game object you want the animation on. Go to ‘Window/Animation’ to open the Animation window, then click the ‘Add Property’ button. Give a name for your new animation and put it somewhere in your Assets folder (probably in a folder called ‘Animations’). This will add an ‘Animator’ component to the game object you selected.

Now select all your sprites that you want in the animation from the Projects window and drag them into the timeline to the right of the Animation window. Then press the red circle button in the top right to stop ‘recording’.

If you preview your animation, it’s usually too fast. To fix this reduce the ‘Samples’ number until the animation is just want you want.

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *