Sprite Attachments Guide

Guide

Guide

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 6

DownloadSprite Attachments Guide
Open PDF In BrowserView PDF
SPRITE ATTACHMENTS

CONTENTS
Motivation ................................................................................................................................................ 2
Creating a sprite attachment sheet ......................................................................................................... 2
Using a sprite attachment sheet in your game ........................................................................................ 4

Robert J Knoester

SPRITE ATTACHMENTS

MOTIVATION
I was surprised to find out that Unity has no build-in support for adding points to a sprite. I needed this
feature in order to add equipment and weapons to my 2D (sprite sheet based) animated character.
Most people told me I should just avoid using sprite sheet animations and give my character a
skeleton. Although this may have solved this particular issue, it would have completely changed my
workflow and would’ve made it difficult to deform frames in an animation.
After scanning through the asset store I realized that there were solutions, but they required me to use
a wide range of other features that I didn’t need. All I needed was a simple tool that allowed me to put
points on a sprite frame, so that’s what I’ve created.

CREATING A SPRITE ATTACHMENT SHEET
To get started,
1) Create a Sprite Attachment Sheet (Assets -> Create -> Sprite Attachment Sheet).
2) Select the sprite attachment sheet you’ve just created and drag your sprite sheet texture into it
in the inspector.
3) While keeping the sprite attachment sheet selected, open the sprite attachment editor window
(Window -> Sprite Sheet Attachments).
4) You will see something like this:

The editor will automatically detect the sprites you’ve sliced from the unity sprite editor.
5) Select one of your sprites and in the Attachments section, click ‘Create’ and enter a unique
name for your attachment (e.g. Hat).
6) A circle will appear in the top left corner, you can drag it around to determine where you want
to place it on the sprite.
7) Of course, you have to place them for each frame of your sprite sheet.
Robert J Knoester

SPRITE ATTACHMENTS
8) Example:

You can click the buttons in the attachments section or just click on a circle to select one.
Give your attachments logical names to make it easy to identify them later.

9) After you’ve finished placing the points on your sprite frames, you can just close the window
(don’t worry, your changes are always saved).

Robert J Knoester

SPRITE ATTACHMENTS

USING A SPRITE ATTACHMENT SHEET IN YOUR GAME
Using the sprite attachment sheet we’ve created earlier, we will now use it in the game.
1)
2)
3)
4)

Add a child game object to your (in my case player) game object.
Make sure it’s on position (0, 0, 0), rotation (0, 0, 0), scale (0, 0, 0)
Add component  to this game object.
You’ll see: (see next page)

5) Drag your sprite renderer (in my case BaseHuman) from the hierarchy to the Sprite Renderer
field.
6) Drag your Sprite Attachment Sheet from Assets to the Sheet field.
7) You’ll see:

The sprite attachments component will automatically generate the attachments for you.

Robert J Knoester

SPRITE ATTACHMENTS

If you play your animation in the game, you’ll see that the sprite attachments will automatically be
positioned correctly (even when you flipX, flipY, scale or change the pixels per unit of the sprite). I use
Gizmos to display this.

You can disable the Gizmos in the Gizmos menu and uncheck: SpriteAttachments.

Robert J Knoester

SPRITE ATTACHMENTS
I hope this tool proves useful to anyone.
Texture from: http://opengameart.org/

Robert J Knoester



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 6
Language                        : nl-NL
Tagged PDF                      : Yes
Title                           : sprite attachments
Author                          : Robert
Creator                         : Microsoft® Word 2013
Create Date                     : 2016:01:03 19:00:42+01:00
Modify Date                     : 2016:01:03 19:00:42+01:00
Producer                        : Microsoft® Word 2013
EXIF Metadata provided by EXIF.tools

Navigation menu