Working with Sprite Sheets in Unity

Sprites are a vital part of working on a game in Unity. Part of that is how do you go about slicing a sprite that contains multiple images within it. I’m going to spend some time going through a basic example of how to split a sprite and hook it up to …


This content originally appeared on DEV Community and was authored by Joseph Maurer

Sprites are a vital part of working on a game in Unity. Part of that is how do you go about slicing a sprite that contains multiple images within it. I’m going to spend some time going through a basic example of how to split a sprite and hook it up to an animation 2D platform game! Let’s get started!

To start you are going to need to acquire a sprite sheet from somewhere. Here is a link to where I acquired the platform character for this project.
image

Once imported into Unity, you are going to need to splice the sprite. You can do this in a number of ways, but I suggest starting by seeing if Unity can automatically figure out each of the images. To do this, use automatic mode as pictured below.
image

Once finished, you will see a light grey box around each of the images in the sheet. Hit Apply and let Unity work the magic behind the scenes to cut each image into a usable asset. You will know it is done when you can expand the sheet and see each image appended. Something like this:
image

At this point, you can start making your animations for your character. In my basic example, this just involved swapping the sprites on each possible state to be the correct image.

Pro tip: Expose lots of variables within your Animator so that it’s easy to tell your player how to move!
image

And then you’re done! You now have an easy way to control your player in code so that you can make a cool game!

I hope this tip helps! Follow me on twitter for more tech tips!


This content originally appeared on DEV Community and was authored by Joseph Maurer


Print Share Comment Cite Upload Translate Updates
APA

Joseph Maurer | Sciencx (2021-06-11T21:22:14+00:00) Working with Sprite Sheets in Unity. Retrieved from https://www.scien.cx/2021/06/11/working-with-sprite-sheets-in-unity/

MLA
" » Working with Sprite Sheets in Unity." Joseph Maurer | Sciencx - Friday June 11, 2021, https://www.scien.cx/2021/06/11/working-with-sprite-sheets-in-unity/
HARVARD
Joseph Maurer | Sciencx Friday June 11, 2021 » Working with Sprite Sheets in Unity., viewed ,<https://www.scien.cx/2021/06/11/working-with-sprite-sheets-in-unity/>
VANCOUVER
Joseph Maurer | Sciencx - » Working with Sprite Sheets in Unity. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/11/working-with-sprite-sheets-in-unity/
CHICAGO
" » Working with Sprite Sheets in Unity." Joseph Maurer | Sciencx - Accessed . https://www.scien.cx/2021/06/11/working-with-sprite-sheets-in-unity/
IEEE
" » Working with Sprite Sheets in Unity." Joseph Maurer | Sciencx [Online]. Available: https://www.scien.cx/2021/06/11/working-with-sprite-sheets-in-unity/. [Accessed: ]
rf:citation
» Working with Sprite Sheets in Unity | Joseph Maurer | Sciencx | https://www.scien.cx/2021/06/11/working-with-sprite-sheets-in-unity/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.