Free Automated Sprite Packer

free automated sprite packer

Free Automated Sprite Packer

This is a free automated sprite packer for your video game projects. Optimized for Unity, Unreal or any 3D and 2D engine you might use. We even provide you with the C# code to use it with.

Instructions on how to use it

To use this Web App just create a .zip file with your files named in order of appearance in the animation sprite. For example: frame01.png, frame02.png frame03.png and so on.
Make sure all of the image files have the same .png extension. Yes it keeps the Alpha(transparency) settings.
Make sure all of the image files have the same resolution(size). For example: 512 x 512 or 512 x 1024 and so on.

C# Code to Display Animated Sprite

using UnityEngine;

public class AnimatedTexture : MonoBehaviour
{
public int uvAnimationTileX = 8; //Here you can place the number of columns of your sheet.
public int uvAnimationTileY = 8; //Here you can place the number of rows of your sheet.
public float framesPerSecond = 15.0f;
public float index;

Renderer rend;

private float t = 0.0f;

void Update()
{
// Calculate index
t += Time.deltaTime / 100.0f;
index = t * framesPerSecond;

// stop when exhausting all frames
if (index >= uvAnimationTileX * uvAnimationTileY)
Destroy(gameObject);

// Size of every tile
Vector2 size = new Vector2(1.0f / uvAnimationTileX, 1.0f / uvAnimationTileY);

// split into horizontal and vertical index
float uIndex = index % uvAnimationTileX;
float vIndex = index / uvAnimationTileX;

// build offset
// v coordinate is the bottom of the image in opengl so we need to invert.
Vector2 offset = new Vector2(uIndex * size.x, 1.0f – size.y – vIndex * size.y);

rend = this.GetComponent();
rend.material.SetTextureOffset(“_MainTex”, offset);
rend.material.SetTextureScale(“_MainTex”, size);

}
}

Texture Output:

Sprite Sheet will be tiles wide by tiles high

Select .zip file file to upload:


Advertisements

Search

Language

Contact Us

Studio81
514.831.9497