Game Development Reference
Unity Hands On
Managing Animated Sprite Sequences
Step 1. Download Chapter Three/SpriteManager.zip from the Web
site. Open the project in Unity and open the spritemanage scene.
You will find a single basic plane with the SpriteManagement.js script
attached. The script will be empty. The plane will have a sprite texture
atlas on it.
Step 2. Open SpriteManagement.js in the script editor and add the
code in Listing 3.18 .
Listing 3.18 Controlling Movement of a Sprite with Arrow Keys
private var nextFrame: float = 0;
private var timeBetweenFrames: float;
private var framerate: float = 5.0;
private var mesh : Mesh;
private var texture : Texture2D;