278 words
1 minute

How to Add a 2D Collider to Sprites in Unity

By · Game Designer · Digital Artist
Unity Inspector with a Box Collider 2D component added to a sprite and the green collision boundary visible in the Scene view

Adding collision to sprites is fundamental for 2D game development in Unity — without a collider, a sprite has no physical boundary, so the player walks straight through it. This step-by-step guide is the Inspector flow in five clicks.

Once the collider is in place, the next thing that tends to go sideways is the player sticking to the collider edges. The fix lives in How to Get Rid of Sticky Walls in Unity.

Select Your Sprite#

Click on the sprite you want to give a collider. The Inspector panel on the right side displays all available settings for that object.

Unity editor with a 2D sprite selected in the Hierarchy and its full settings shown in the Inspector panel on the right

Add the Collider Component#

In the Inspector, find Add Component. Navigate to Physics 2D and select Box Collider 2D — or any other collider that matches your sprite shape.

Unity Inspector Add Component dropdown opened with the Physics 2D submenu visible

Unity Inspector Physics 2D submenu with Box Collider 2D ready to select

Adjust the Collider#

A green boundary box now appears around your sprite. To refine the boundary, click Edit Collider within the Box Collider 2D component settings. Small adjustment handles appear — drag them to customize the collider’s shape and size.

Unity Scene view with the default green Box Collider 2D boundary surrounding the selected sprite

Unity Scene view in Edit Collider mode with the green handle dots ready to be dragged to reshape the collider

Result#

With a collider in place, your object now has a physical boundary. The player (or other physics objects) can’t pass through it.

Unity gameplay view showing the final collider in action: the player can no longer pass through the sprite boundary

Related Posts

Same category
  1. 1
    Maya Basics — a Five-Minute Tour
    Cookbook · A short tour of the Autodesk Maya interface — workspace, viewport navigation, primitive shapes, modeling tools, and the channel box. For first-timers.
  2. 2
    How to Color in Corel Painter
    Cookbook · The Corel Painter colour picker in one tour — open the palette, the detailed mixer, the eyedropper, and how to build a custom palette from scratch.
  3. 3
    How to Get Rid of Sticky Walls in Unity
    Cookbook · The quick fix for characters sticking to walls in 2D Unity — create a Physics Material 2D with zero friction and apply it to your player's Rigidbody 2D.
  4. 4
    How to Add an Icon for a Game in Unity
    Cookbook · The shortest path to setting a game icon in Unity — File → Build Settings → Player Settings — plus fixes for the two mini-problems you'll run into.

Random Posts

Random
  1. 1
    How to Color in Procreate
    Cookbook · The tools I reach for when picking and applying color in Procreate — eyedropper, ColorDrop, and a tour of the Disc, Classic, Value, and Palettes modes.
  2. 2
    How to Add an Icon for a Game in Unity
    Cookbook · The shortest path to setting a game icon in Unity — File → Build Settings → Player Settings — plus fixes for the two mini-problems you'll run into.
  3. 3
    How to Color in Corel Painter
    Cookbook · The Corel Painter colour picker in one tour — open the palette, the detailed mixer, the eyedropper, and how to build a custom palette from scratch.
  4. 4
    How to Use Brushes in Photoshop
    Cookbook · Where to find the Brush Panel, why Brush Settings matter, and how to load custom ABR brush sets — the three Photoshop brush moves every painter sets up first.
How to Add a 2D Collider to Sprites in Unity
https://heyleiloo.com/step-by-step-guide-adding-a-2d-collider-to-sprites-in-unity/
Author
Leila Mikhaleva
Published
2025-04-12
License
CC BY-NC-ND 4.0