AutoSprite

Unity Integration

Complete guide to importing AutoSprite spritesheets into Unity, setting up animations, and using the Unity plugin.

This guide covers importing AutoSprite exports into Unity and setting up animated sprites.

â„šī¸

Need to generate the asset first? Start with the Unity sprite sheet generator workflow, then use this guide for import settings, slicing, and clips.

💡

Using Unity? Skip the manual setup. Our free AutoSprite Unity Extension auto-slices your spritesheet, builds animation clips with the right frame order and timing, and wires up the Animator Controller for all 4 directions — drop in your PNG + JSON and you're done. See the full extension guide for install steps and usage.

The manual instructions below are for everyone else (or anyone who wants to know what the extension is doing under the hood).

Quick Start

Install 2D Sprite Package

In Unity Editor, go to Window → Package Manager. Find 2D Sprite and install it if not already installed.

Import the Spritesheet

Drag your PNG spritesheet into your Unity project's Assets folder, or copy it directly into the Assets directory.

Configure Import Settings

Select the spritesheet in the Project window, then in the Inspector:

  • Texture Type: Sprite (2D and UI)
  • Sprite Mode: Multiple (required to slice into frames)
  • Pixels Per Unit: Match your game scale (16, 32, 64, etc.)
  • Filter Mode: Point (for pixel art) or Bilinear
  • Compression: None (for best quality)
  • Click Apply

Slice the Spritesheet

Click Sprite Editor button, then:

  • Select Slice dropdown
  • Set Type: Grid By Cell Size
  • Enter your frame dimensions (from the JSON atlas "w" and "h" values)
  • Click Slice, then Apply

Create Animations

  • Select all frames for an animation in the Project window
  • Drag them into the Scene view
  • Unity automatically creates an Animation clip and Animator Controller

Detailed Setup

Import Settings Explained

SettingRecommended ValueWhy
Texture TypeSprite (2D and UI)Enables sprite features
Sprite ModeMultipleTells Unity this has multiple frames
Pixels Per Unit32 (or your game's scale)Controls sprite size in-game
Filter ModePointKeeps pixel art sharp
CompressionNonePreserves quality

Using the Sprite Editor

  1. With spritesheet selected, click Sprite Editor button in Inspector
  2. Click the Slice button in the toolbar
  3. Choose Grid By Cell Size or Grid By Cell Count
  4. Enter dimensions from your JSON atlas:
    • Look for "w" and "h" values in frame data
    • Common sizes: 64x64, 128x128, 256x256
  5. Click Slice to preview the cuts
  6. Adjust pivot point if needed (usually Center or Bottom)
  7. Click Apply to save

Creating Animation Clips

Method 1: Drag & Drop (Fastest)

  1. In Project window, expand your sliced spritesheet
  2. Select frames for one animation (e.g., idle_down_0, idle_down_1...)
  3. Drag into the Hierarchy or Scene view
  4. Unity creates both Animation clip and Animator Controller automatically
  5. Save the Animation clip when prompted

Method 2: Animation Window

  1. Select your sprite GameObject in the Hierarchy
  2. Open Window → Animation → Animation
  3. Click Create and name your clip
  4. Drag frames from Project into the timeline
  5. Adjust Samples (frame rate) - 12 fps for pixel art, 24 fps for smoother animation

Setting Up the Animator

Your Animator Controller needs states for each animation:

  • Idle - Default state (Entry → Idle)
  • Walk - Triggered by movement input
  • Run - Triggered by run/sprint input
  • Jump - Triggered by jump input
  • Attack - Triggered by attack input

Use Parameters to control transitions:

  • Speed (float) - For walk/run blending
  • IsGrounded (bool) - For jump/fall states
  • Attack (trigger) - For attack animation

Code Example

Here's how to control animations in code:

using UnityEngine;

public class PlayerAnimation : MonoBehaviour
{
    private Animator animator;
    private SpriteRenderer spriteRenderer;

    void Start()
    {
        animator = GetComponent<Animator>();
        spriteRenderer = GetComponent<SpriteRenderer>();
    }

    void Update()
    {
        // Get input
        float horizontal = Input.GetAxis("Horizontal");
        float vertical = Input.GetAxis("Vertical");
        float speed = new Vector2(horizontal, vertical).magnitude;

        // Update animator
        animator.SetFloat("Speed", speed);

        // Handle facing direction
        if (horizontal != 0)
        {
            spriteRenderer.flipX = horizontal < 0;
        }

        // Handle jump
        if (Input.GetButtonDown("Jump"))
        {
            animator.SetTrigger("Jump");
        }

        // Handle attack
        if (Input.GetButtonDown("Fire1"))
        {
            animator.SetTrigger("Attack");
        }
    }
}

Tips for Unity

✨
Pro Tip:

For pixel art games, always set Filter Mode to Point and Compression to None. This keeps your sprites crisp at any scale.

Common Issues

Sprites look blurry:

  • Set Filter Mode to Point (no filter)
  • Set Compression to None
  • Make sure you clicked Apply after changing settings

Animation plays too fast/slow:

  • Select the Animation clip in Project window
  • Adjust Samples value (frame rate)
  • 12 fps is good for pixel art, 24 fps for smoother animation

Pivot point is wrong:

  • Open Sprite Editor
  • Select individual frames
  • Change Pivot dropdown or drag the pivot point
  • Click Apply

Sprite Mode not showing Multiple option:

  • Make sure 2D Sprite package is installed
  • Check Texture Type is set to Sprite (2D and UI)

Learn More

Godot Integration