Unity Foundations·From empty scene to playable build

Physics, colliders and triggers

Colliders define shape; Rigidbodies make physics act on an object.

Beginner 14 min read Lesson 8 of 300 Challenge included
What you will be able to do
  • One Rigidbody per physics object, not one per child collider.
  • Use layer masks to control what can collide.
  • Do not move a Rigidbody by changing Transform directly.

In plain English

Use a Rigidbody for objects that move under physics. Colliders without a Rigidbody are static. Triggers detect overlap without blocking. Put collision responses in a component that has the context to decide what happens.

Pickup.csC#
using UnityEngine;

public class Pickup : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
        if (!other.CompareTag("Player")) return;

        GameManager.Instance.AddScore(10);
        Destroy(gameObject);
    }
}
Your turn

Collect a pickup

Medium

On trigger enter by the Player, add 10 score and destroy the pickup.

CSHARP · starter
private void OnTriggerEnter(Collider other) {}
Check your understanding before moving on.
Knowledge checkQuestion 1

What is the difference between a collider and a trigger?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Lesson 8 of 300 · 0% of course