Very simple tool to create collider data for sprite animations.
Easier setup of hitboxes for iframes or hurtboxes to deal damage on specific frames.
- Create colliders that map one to one with the pixel size of your sprites
- Works with built in animator, although you can use it in other contexts
- Poll an event and it will automatically use the correct frame and collider type
- Hitbox and Hurtbox
- Extensible to support more features like events
- Supports flipping the SpriteCollider
- Preview collider in scene view
- Currently the window size is locked to 1024x1024
- Window can be opened via the "Tools/Sprite Collider" menu in the top menu bar.
- You can also open
SpriteColliderDataassets by double clicking them in the project window.
- Drag an
AnimationCliponto the Sprite Collider window.
- Click the Add button in the window and select the collider type
- Each collider gets a keyframe for each frame in the animation clip
- Right click the keyframe to enable/disable it
- Select one of the keyframes in the lower area, the selected keyframe will have a small green circle inside it
- The top area will show a box that shares the color with the collider type
- Move the box by right clicking and dragging it
- Expand the box by left click and drag one of the edges
- Add the
SpriteColliderPreviewcomponent to aGameObjectin the scene and drag theSpriteRendereronto it - Open a relevant
SpriteColliderDataand have theGameObjectselected - The selected frame and collider box is show in the scene view
- Add both the
SpriteColliderandHitboxcomponent to a GameObject - Assign the needed components to both of them
AnimatorandSpriteRendererforSpriteCollider- A
BoxCollider2DforHitbox
- Assign all the
SpriteColliderDataassets to theSpriteCollidercomponent, they will automatically map to the AnimationClip it was created with- if no
SpriteColliderDataexists for an animation clip no hurtbox exist, but the hitbox will still work. It will use the default size of theBoxCollider2Dassigned to it.
- if no
- Hitbox data is set from the current animation playing and can be listened and used the usual Unity way
- Hurtbox data can be polled by calling
SpriteCollider::CheckEvent(eventType, ...)
( sprite art in images is from rvros's adventurer pack )