Working with Sprite Sheets in Unity | by Joseph Maurer | Geek Tradition


Sprites are a significant a part of engaged on a sport in Unity. A part of that’s how do you go about slicing a sprite that incorporates a number of photos inside it. I’m going to spend a while going by a primary instance of the way to break up a sprite and hook it as much as an animation 2D platform sport! Let’s get began!

To begin you’re going to want to amass a sprite sheet from someplace. Here’s a hyperlink to the place I acquired the platform character for this venture.

As soon as imported into Unity, you’re going to must splice the sprite. You are able to do this in various methods, however I counsel beginning by seeing if Unity can mechanically determine every of the photographs. To do that, use automated mode as pictured beneath.

As soon as completed, you will note a light-weight gray field round every of the photographs within the sheet. Hit Apply and let Unity work the magic behind the scenes to chop every picture right into a usable asset. You’ll know it’s completed when you’ll be able to broaden the sheet and see every picture appended. One thing like this:

At this level, you can begin making your animations in your character. In my primary instance, this simply concerned swapping the sprites on every attainable state to be the right picture.

Professional tip: Expose a number of variables inside your Animator in order that it’s simple to inform your participant the way to transfer!

And you then’re completed! You now have a straightforward option to management your participant in code in an effort to make a cool sport!

Leave a Reply

Your email address will not be published. Required fields are marked *