Then, click Slice:Ĭlick Apply in the Sprite Editor window to apply the changes: Leave the other values at 0 and Pivot set to Center. Under Pixel Size, enter 9 for X and 32 for Y. Selecting the cell size option lets you specify the size of each frame in your spritesheet using pixel dimensions.Ĭlick Grid by Cell Size under the Slice menu in the Sprite Editor: In this scenario, it’ll work just fine, but you could also slice your spritesheet by cell size or cell count. This means Unity will attempt to locate and slice your spritesheet on its own to the best of its ability. A new window pops up to show the spritesheet automatically sliced into individual frames (the numbers were added for illustration purposes and aren’t part of the screenshot):Ĭlick Slice in the upper-left corner of the window, noticing Automatic is the default slice operation: Go back to thruster-spritesheet.png and click Sprite Editor again. Click Install to add the tools to your project. Select Unity Registry from the Packages drop-down, and find 2D Sprite. This warning appears the first time you try to open the Sprite Editor. In newer versions of Unity, the Sprite Editor isn’t installed by default it’s moved into the package system and needs to be added. In the Inspector, the Sprite Mode is already set to Multiple (if not, change it, then click Apply). Both of these animations consist of multiple frames, which you can edit and slice using the Sprite Editor.Īssets/Sprites/Explosion/explosion-spritesheet.png has already been sliced and prepared into an animation for you, but Assets/Sprites/thruster-spritesheet.png still needs some attention.Ĭlick Assets/Sprites/thruster-spritesheet.png in the Project window. You’ll use two spritesheets in this game: one for the lander’s thruster animation, and one for an explosion animation. It’s convenient to pack multiple graphic elements into a single image for animations or objects that have lots of moving parts Unity makes it easy to manage these spritesheets with a built-in 2D spritesheet editor. Of course, organization of your spritesheets is just as important as using them, but that’s for another tutorial! Sprite Editing For a few dozen sprites, this isn’t a big deal, but as your game grows in complexity and scope, this could be a potential issue.īy using spritesheets, you’re making one draw call for lots of Sprites, thus giving your game a performance boost. The reason for using spritesheets is that every image you use in your game will take up one draw call. Examples: triangle, square, pentagon, hexagon.Ī spritesheet is a single image that contains lots of smaller individual images, like so: Polygon: A custom polygon-shaped sprite that you can create many different types of primitive shapes with.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |