Say you want to make an old school pixel style game, where you have animations defined in sprite sheets, like in the following image (right-click and click “Save image as…” to save to disk):
Or, say that you want to create an animated video on a mesh (but you don’t want to use a video texture for some reason). Convert the video into a spritesheet like the following (right-click and click “Save image as…” to save to disk):
I will not show you how to convert the video in this tutorial, but I can show you how to make the animation inside Create.
- Put the spritesheet texture in the Diffuse Texture slot in the material panel on your entity.
- Update the rest of the material settings, so the entity looks good. If you’re using the explosion spritesheet and want a “sprite look”, set all colors to black, except for the Ambient color, which you set to white. Set renderqueue to Transparent and blending to TransparencyBlending.
- Put the script provided below in a Script Component on the same entity.
- Enter the number of sprites in the sprite sheet in X and Y directions, in the “tiling” parameter field. 9x9 for the explosion and 5x5 for the mountain spritesheet.
- Set the speed of the animation in the “animationTime” parameter. This number is the number of seconds it takes for the whole animation to loop once.
- Press Play.
You can find the UV animation script below. The only thing it does is setting the UV Repeat and UV Offset of the texture each frame, depending on the current time. The resulting effect is a spritesheet animation on the mesh.