Unity Physics Layers and Collision Matrix
Interactive Unity collision matrix editor with presets and C# code export.
Unity's Physics Layer Collision Matrix controls which layers can collide with which. Configuring it correctly reduces unnecessary physics checks and prevents unwanted collisions. This interactive editor lets you toggle collisions, apply game-genre presets, and export the configuration as C# code.
Layer Names
Layers 0 to 5 are Unity built-in and cannot be renamed. Layers 6 to 9 are custom and editable.
Presets
All layers collide with all layers.
Collision Matrix(55/55 pairs enabled)
| Default | TransparentFX | Ignore Raycast | Water | UI | Player | Enemy | Projectile | Environment | ||
|---|---|---|---|---|---|---|---|---|---|---|
| Default | ||||||||||
| TransparentFX | ||||||||||
| Ignore Raycast | ||||||||||
| Water | ||||||||||
| UI | ||||||||||
| Player | ||||||||||
| Enemy | ||||||||||
| Projectile | ||||||||||
| Environment |
C# Code Output
// ============================================
// Physics Layer Collision Configuration
// ============================================
//
// Collision summary:
// Default collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// TransparentFX collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// Ignore Raycast collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// Water collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// UI collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// Player collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// Enemy collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// Projectile collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
// Environment collides with: Default, TransparentFX, Ignore Raycast, , Water, UI, Player, Enemy, Projectile, Environment
//
// ============================================
void SetupLayerCollisions()
{
// All layers collide with all layers (Unity default).
// No Physics.IgnoreLayerCollision calls needed.
}Related Tools
Shader Properties
Searchable reference for Unity shader property names with C# get/set code for Standard, URP, and HDRP.
Scripting Order
Interactive Unity MonoBehaviour lifecycle diagram. When does Awake, Start, Update, and every callback run.
Game Maths
Interactive cheat sheet with live visualisations. Distance, lerp, dot product, vectors, and more with Unity C# code.
Frequently asked questions
How many physics layers can Unity support?
What is the difference between layers and tags?
How do I make a raycast ignore certain layers?
Why is my collision matrix being ignored?
Last updated: