Learn how to import and export sprite sheets in Unity, Unreal Engine, Godot, and Phaser with step-by-step guides and downloadable examples.
Before diving into the technical guides, see how these sprite sheets animate in real-time. These examples work perfectly in all the game engines covered below.
Sprite Sheet
Animated
Perfect for Unity physics demosSprite Sheet
Animated
Great for Unreal Engine 2D gamesSprite Sheet
Animated
Ideal for Godot and Phaser projectsusing UnityEngine;
public class SpriteAnimator : MonoBehaviour {
public Sprite[] frames;
public float frameRate = 12f;
SpriteRenderer sr;
int index; float timer;
void Awake() => sr = GetComponent<SpriteRenderer>();
void Update() {
timer += Time.deltaTime;
if (timer >= 1f / frameRate) {
index = (index + 1) % frames.Length;
sr.sprite = frames[index];
timer = 0f;
}
}
}// C++ Flipbook playback
UPaperFlipbookComponent* FlipbookComponent;
void AMyActor::BeginPlay() {
Super::BeginPlay();
FlipbookComponent->PlayFromStart();
FlipbookComponent->SetPlayRate(2.0f); // 2x speed
}# GDScript animation control
extends Node2D
@onready var animated_sprite = $AnimatedSprite2D
func _ready():
animated_sprite.play("walk")
animated_sprite.speed_scale = 1.5 # 1.5x speedthis.load.spritesheet specifying frame width and height.this.anims.create.play.// Phaser 3 sprite sheet animation
function preload() {
this.load.spritesheet('ball', 'bouncing-ball.png', {
frameWidth: 32,
frameHeight: 32
})
}
function create() {
this.anims.create({
key: 'bounce',
frames: this.anims.generateFrameNumbers('ball'),
frameRate: 12,
repeat: -1
})
const sprite = this.add.sprite(100, 100, 'ball')
sprite.play('bounce')
}