Sprites are an important 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 via a fundamental instance of easy methods to break up a sprite and hook it as much as an animation 2D platform sport! Let’s get began!
To begin you’ll want to accumulate a sprite sheet from someplace. Here’s a hyperlink to the place I acquired the platform character for this undertaking.
As soon as imported into Unity, you’ll have to splice the sprite. You are able to do this in quite a few methods, however I counsel beginning by seeing if Unity can routinely work out every of the photographs. To do that, use computerized mode as pictured beneath.
As soon as completed, you will notice 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 performed 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 to your character. In my fundamental instance, this simply concerned swapping the sprites on every potential state to be the proper picture.
Professional tip: Expose plenty of variables inside your Animator in order that it’s straightforward to inform your participant easy methods to transfer!
And then you definitely’re performed! You now have a straightforward option to management your participant in code with the intention to make a cool sport!