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
SpriteColliderData
assets by double clicking them in the project window.
- Drag an
AnimationClip
onto 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
SpriteColliderPreview
component to aGameObject
in the scene and drag theSpriteRenderer
onto it - Open a relevant
SpriteColliderData
and have theGameObject
selected - The selected frame and collider box is show in the scene view
- Add both the
SpriteCollider
andHitbox
component to a GameObject - Assign the needed components to both of them
Animator
andSpriteRenderer
forSpriteCollider
- A
BoxCollider2D
forHitbox
- Assign all the
SpriteColliderData
assets to theSpriteCollider
component, they will automatically map to the AnimationClip it was created with- if no
SpriteColliderData
exists for an animation clip no hurtbox exist, but the hitbox will still work. It will use the default size of theBoxCollider2D
assigned 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 )