Unity Sprite Sheet Animation Script
You might find it useful to drag the tab of the sprite editor window and dock it.
Unity sprite sheet animation script. This process will include importing and slicing a sprite sheet ken from street fighter assigning animation states with the new animation controller and scripting simple keyboard controls to change. The code of the script only runs during development. In this tutorial i will be explaining how to manage 2d animation states for characters in unity3d using the new 2d tools that shipped with version 4 3. If you don t know how to use coroutine.
There are various ways to create sprite animations. In this script the coroutine is used for sprite sheet animation. We will use a sprite sheet with animator controller to animate our 2d charact. To change a sprite from a script in unity create a reference variable to hold the new sprite.
Again in the inspector window click the sprite editor button. Then set the sprite property of the sprite renderer component on the game object you wish to change to match the new replacement sprite. In this tutorial i ll show you how to make sprite sheets in ps and then how to import those into unity to make 2d game ready animations. One way is to create them from a sprite sheet a collection of sprites arranged in a grid.
Don t worry our coroutine unity blog post will help you. The script extends unity to read sprite sheet data created with texturepacker and to automatically create native unity assets which you can use with the unity editor. The sprite editor as well as the sprite texture type are new to unity 4 3. The new texture type importer allows us to manipulate the image in new and entertaining ways specifically meant for 2d while the editor allows us to fine tune how this sprite sheet is broken down into individual sprites.
The sprites are then compiled into an animation clip that will play each sprite in order to create the animation much like a flipbook. I docked mine alongside the projects tab as shown in the next image. Use anim preview from the top toolbar to see an animation of the selected sprites. Changes to the pivot points are updated.
Now unity knows treat player png as a sprite sheet with multiple frames of animation.