Sprites are an important a part of engaged on a recreation 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 way of a fundamental instance of methods to cut up a sprite and hook it as much as an animation 2D platform recreation! Let’s get began!
To start out you’re going to 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’re going to must splice the sprite. You are able to do this in numerous methods, however I counsel beginning by seeing if Unity can mechanically determine every of the photographs. To do that, use computerized mode as pictured under.
As soon as completed, you will note a lightweight 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 achieved 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 on your character. In my fundamental instance, this simply concerned swapping the sprites on every doable state to be the right picture.
Professional tip: Expose a lot of variables inside your Animator in order that it’s simple to inform your participant methods to transfer!
And then you definately’re achieved! You now have a simple method to management your participant in code so as to make a cool recreation!