Monday, August 1, 2022
HomeSoftware EngineeringWorking with Sprite Sheets in Unity | by Joseph Maurer | Geek...

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 pictures inside it. I’m going to spend a while going via a primary instance of the way to cut up a sprite and hook it as much as an animation 2D platform sport! Let’s get began!

To start out you’ll want to accumulate a sprite sheet from someplace. Here’s a hyperlink to the place I acquired the platform character for this challenge.

As soon as imported into Unity, you’ll must splice the sprite. You are able to do this in various methods, however I recommend beginning by seeing if Unity can routinely work out every of the pictures. To do that, use computerized mode as pictured under.

As soon as completed, you will note a lightweight gray field round every of the pictures 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 carried out when you’ll be able to develop the sheet and see every picture appended. One thing like this:

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

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

And you then’re carried out! You now have a simple strategy to management your participant in code so to make a cool sport!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular