Physics Layers
Physics layers provide a method for filtering collisions between colliders. They are also used by sensors to filter which colliders should be detected. Each layer must have a unique name, but a layer can be assigned to many different colliders. You can specify all the layers that should interact with any given layer. If a layer isn’t set for a collider/sensor then it is assigned the default layer, which interacts with all layers.
Sensors
It’s important to understand that assigning a layer to a sensor does not necessarily mean that the sensor should detect colliders that are assigned that particular layer. It specifies that the sensor has that particular layer. The colliders that are detected are any colliders with layers that are set to interact with the sensor’s layer. For example, it is common to create a “Sensors” layer, which can then be configured to interact with any other layers.
Performance
Layers can be used to improve performance by reducing the number of pairs of colliders that need to be tested during collision detection.