In this lesson, you will learn how to choose between physical collisions and trigger zones to script the right reaction when two objects touch in your game.
The Physics Dilemma
When two objects with Colliders meet, Unity needs to know how they should interact. Do you want them to bounce off each other like a ball hitting a wall, or do you want the object to pass through like a ghost moving through a doorway? This is the fundamental difference between a Collision and a Trigger.
Solid Collisions
A standard collision occurs when both objects have Colliders and at least one has a Rigidbody. By default, physics simulation treats these as solid bodies. When they touch, Unity fires OnCollisionEnter, OnCollisionStay, or OnCollisionExit. Use these when you want physical feedback, like your character landing on a floor or a crate sliding across a surface.
Trigger Zones
If you check the Is Trigger box on a Collider, the object becomes a "sensor" that passes through other objects without physical resistance. These are perfect for gameplay logic that shouldn't involve physics forces, such as picking up an item, entering a checkpoint, or walking through a pressure plate. Instead of collision methods, triggers use OnTriggerEnter, OnTriggerStay, and OnTriggerExit.
Code Implementation
Here is how you differentiate the two in your scripts:
// For physical impacts (solid walls, floors, objects)
void OnCollisionEnter(Collision collision) {
Debug.Log("Physical bump! We hit: " + collision.gameObject.name);
}
// For gameplay logic (checkpoints, item pickups)
void OnTriggerEnter(Collider other) {
Debug.Log("Trigger entered by: " + other.gameObject.name);
}
When writing your script, ask yourself: "Do I want the objects to stop each other?" If yes, use a standard Collider. If you want to detect an overlap without stopping movement, use an Is Trigger setup. Mixing these up is a common source of logic bugs, so always verify your Is Trigger settings in the Inspector when your events aren't firing as expected.
Key Takeaway: Use standard Collisions for solid physical interactions and Trigger events for non-physical, detection-based gameplay logic.