Bird
Raised Fist0
Unityframework~10 mins

Trigger vs collision detection in Unity - Visual Side-by-Side Comparison

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Concept Flow - Trigger vs collision detection
Object A moves
Check Collider Overlap?
NoNo Interaction
Yes
Is Trigger?
YesTrigger Event Fired
Is Trigger?
NoCollision Event Fired
When two objects move, Unity checks if their colliders overlap. If yes, it checks if either collider is a trigger. If trigger, trigger events fire; otherwise, collision events fire.
Execution Sample
Unity
void OnTriggerEnter(Collider other) {
    Debug.Log("Trigger detected with " + other.name);
}

void OnCollisionEnter(Collision collision) {
    Debug.Log("Collision detected with " + collision.gameObject.name);
}
This code logs messages when an object enters a trigger or collides physically with another object.
Execution Table
StepObject A PositionObject B PositionCollider Overlap?Is Trigger?Event FiredOutput
1(0,0,0)(5,0,0)No-NoneNo event
2(4,0,0)(5,0,0)YesYesTrigger EventTrigger detected with ObjectB
3(4,0,0)(5,0,0)YesNoCollision EventCollision detected with ObjectB
4(6,0,0)(5,0,0)No-NoneNo event
💡 When objects no longer overlap, no events fire.
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3After Step 4
Object A Position(0,0,0)(0,0,0)(4,0,0)(4,0,0)(6,0,0)
Object B Position(5,0,0)(5,0,0)(5,0,0)(5,0,0)(5,0,0)
Collider OverlapFalseFalseTrueTrueFalse
Is TriggerN/AN/AYes/NoYes/NoN/A
Event FiredNoneNoneTrigger or CollisionTrigger or CollisionNone
Key Moments - 3 Insights
Why does OnTriggerEnter fire but OnCollisionEnter does not when the collider is a trigger?
Because when a collider is marked as a trigger, Unity does not treat it as a physical collision but as an overlap event, so only trigger events fire (see execution_table step 2).
Can both OnTriggerEnter and OnCollisionEnter fire at the same time for the same objects?
No, only one event type fires depending on whether the collider is a trigger or not (see execution_table steps 2 and 3).
What happens if objects stop overlapping after a collision or trigger event?
No events fire when objects are apart, as shown in execution_table step 4 where overlap is false and no event occurs.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step does the trigger event fire?
AStep 1
BStep 2
CStep 3
DStep 4
💡 Hint
Check the 'Event Fired' column for 'Trigger Event' in the execution_table.
According to variable_tracker, what is Object A's position after step 3?
A(4,0,0)
B(0,0,0)
C(6,0,0)
D(5,0,0)
💡 Hint
Look at the 'Object A Position' row under 'After Step 3' in variable_tracker.
If Object B's collider was not a trigger, which event would fire when overlapping occurs?
ATrigger Event
BNo Event
CCollision Event
DBoth Trigger and Collision Events
💡 Hint
Refer to execution_table step 3 where 'Is Trigger?' is No and 'Collision Event' fires.
Concept Snapshot
Trigger vs Collision Detection in Unity:
- Trigger colliders detect overlaps without physical response.
- Collision colliders detect physical impacts.
- OnTriggerEnter fires when a trigger collider overlaps.
- OnCollisionEnter fires when colliders physically collide.
- Only one event type fires per overlap based on collider settings.
Full Transcript
In Unity, when two objects move, the engine checks if their colliders overlap. If they do, it then checks if either collider is set as a trigger. If yes, Unity fires trigger events like OnTriggerEnter, which detect overlaps without physical collision. If not, Unity fires collision events like OnCollisionEnter, which detect physical impacts. The execution table shows objects moving closer, overlapping, and which events fire depending on the collider settings. Variable tracking shows positions and overlap states changing step by step. Key moments clarify common confusions about why only one event fires and what happens when objects stop overlapping. The visual quiz tests understanding of event firing steps and variable states. This helps beginners see clearly how Unity distinguishes triggers from collisions during gameplay.

Practice

(1/5)
1. What is the main difference between a trigger and a collision in Unity?
easy
A. Triggers detect overlaps without blocking movement, collisions detect physical contact and block movement.
B. Triggers block movement, collisions only detect overlaps.
C. Triggers require Rigidbody, collisions do not.
D. Triggers and collisions behave exactly the same.

Solution

  1. Step 1: Understand trigger behavior

    Triggers detect when objects overlap but do not physically block each other.
  2. Step 2: Understand collision behavior

    Collisions detect physical contact and prevent objects from passing through each other.
  3. Final Answer:

    Triggers detect overlaps without blocking movement, collisions detect physical contact and block movement. -> Option A
  4. Quick Check:

    Trigger = overlap, Collision = block [OK]
Hint: Triggers overlap only; collisions block movement [OK]
Common Mistakes:
  • Confusing triggers with collisions as both blocking movement
  • Thinking triggers require Rigidbody always
  • Assuming collisions do not block movement
2. Which of the following is the correct way to make a collider act as a trigger in Unity?
easy
A. Add a Rigidbody component only.
B. Disable the collider component.
C. Set the collider's Is Trigger property to true.
D. Set the collider's material to None.

Solution

  1. Step 1: Identify trigger setup

    In Unity, to make a collider a trigger, you must enable its Is Trigger checkbox.
  2. Step 2: Verify other options

    Adding Rigidbody or disabling collider does not make it a trigger; setting material to None affects physics but not trigger behavior.
  3. Final Answer:

    Set the collider's Is Trigger property to true. -> Option C
  4. Quick Check:

    Is Trigger = true for triggers [OK]
Hint: Enable Is Trigger checkbox on collider [OK]
Common Mistakes:
  • Adding Rigidbody alone to make trigger
  • Disabling collider thinking it triggers events
  • Changing material instead of Is Trigger
3. Consider this Unity C# code snippet:
void OnTriggerEnter(Collider other) {
    Debug.Log("Triggered by " + other.name);
}

void OnCollisionEnter(Collision collision) {
    Debug.Log("Collided with " + collision.gameObject.name);
}
What will be printed if an object with a collider marked as trigger overlaps another object with a collider and Rigidbody?
medium
A. No message will print.
B. Only "Collided with [object name]" will print.
C. Both messages will print.
D. Only "Triggered by [object name]" will print.

Solution

  1. Step 1: Analyze trigger event

    When a collider marked as trigger overlaps another collider with Rigidbody, OnTriggerEnter is called.
  2. Step 2: Analyze collision event

    OnCollisionEnter is called only when colliders physically collide (not triggers).
  3. Final Answer:

    Only "Triggered by [object name]" will print. -> Option D
  4. Quick Check:

    Trigger collider calls OnTriggerEnter only [OK]
Hint: Trigger collider calls OnTriggerEnter, not OnCollisionEnter [OK]
Common Mistakes:
  • Expecting both trigger and collision messages
  • Thinking OnCollisionEnter triggers on overlap
  • Confusing collider types for events
4. You wrote this code but OnTriggerEnter is never called:
void OnTriggerEnter(Collider other) {
    Debug.Log("Triggered");
}
What is the most likely reason?
medium
A. The collider is disabled.
B. The collider's Is Trigger property is not enabled.
C. The method name is misspelled.
D. The object has no Rigidbody component.

Solution

  1. Step 1: Check trigger setup

    OnTriggerEnter only fires if the collider has Is Trigger enabled.
  2. Step 2: Verify other conditions

    Rigidbody is needed on one object but missing Rigidbody alone won't prevent OnTriggerEnter if Is Trigger is off; method name is correct; collider disabled would prevent all events.
  3. Final Answer:

    The collider's Is Trigger property is not enabled. -> Option B
  4. Quick Check:

    Is Trigger must be true for OnTriggerEnter [OK]
Hint: Enable Is Trigger to get OnTriggerEnter calls [OK]
Common Mistakes:
  • Forgetting to enable Is Trigger
  • Assuming Rigidbody absence blocks trigger
  • Misspelling method name
  • Not enabling collider component
5. You want to detect when a player enters a zone without blocking their movement, but also detect when the player physically hits a wall. How should you set up the colliders and Rigidbody components?
hard
A. Set the zone collider as trigger (Is Trigger = true), the wall collider as non-trigger, and add Rigidbody to the player.
B. Set both zone and wall colliders as triggers, add Rigidbody to the player.
C. Set the zone collider as non-trigger, wall collider as trigger, and add Rigidbody to the player.
D. Remove Rigidbody from player and set all colliders as non-trigger.

Solution

  1. Step 1: Configure zone for overlap detection

    Set the zone collider's Is Trigger to true so it detects player entering without blocking movement.
  2. Step 2: Configure wall for physical collision

    Set the wall collider as non-trigger to physically block the player.
  3. Step 3: Rigidbody requirement

    Add Rigidbody to the player so physics and trigger events work properly.
  4. Final Answer:

    Set the zone collider as trigger (Is Trigger = true), the wall collider as non-trigger, and add Rigidbody to the player. -> Option A
  5. Quick Check:

    Trigger zone + Rigidbody player + solid wall = correct setup [OK]
Hint: Trigger zone collider, solid wall collider, Rigidbody on player [OK]
Common Mistakes:
  • Making wall a trigger so player passes through
  • Not adding Rigidbody to player
  • Setting zone collider as non-trigger blocking player