# callbackLayers

> The Layers that this Collider2D will report collision or trigger callbacks for during a contact with another Collider2D.

## Definition

* **Type:** Property
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule

```csharp
public LayerMask callbackLayers { get; set; }
```

### Remarks

When a contact occurs between two [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md), each [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md) will get a collision or trigger callback.  This options allows you to select which layer(s) will produce a callback.

The ability to limit which layers will result in a callback can reduce the complexity of the script inside the callback so that it can safely assume only specific layers will be reported. There is also a performance benefit in not performing callbacks that are not required.

These are all the physics callbacks which are affected by callback layers:

* [OnCollisionEnter2D](/engine/6000.6/script-reference/unityengine/collider2d/oncollisionenter2d.md)
* [OnCollisionStay2D](/engine/6000.6/script-reference/unityengine/collider2d/oncollisionstay2d.md)
* [OnCollisionExit2D](/engine/6000.6/script-reference/unityengine/collider2d/oncollisionexit2d.md)
* [OnTriggerEnter2D](/engine/6000.6/script-reference/unityengine/collider2d/ontriggerenter2d.md)
* [OnTriggerStay2D](/engine/6000.6/script-reference/unityengine/collider2d/ontriggerstay2d.md)
* [OnTriggerExit2D](/engine/6000.6/script-reference/unityengine/collider2d/ontriggerexit2d.md)

**NOTES**:

* This does not control whether the [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md) will come into contact or not but simply if the resultant callback will happen.
* Even if all callback layers are selected, only contacts captured via [Collider2D.contactCaptureLayers](/engine/6000.6/script-reference/unityengine/collider2d/contactcapturelayers.md), will be reported.
* The other [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md) involved in any contact callback disabled here will still receive callbacks defined by its own [callbackLayers](/engine/6000.6/script-reference/unityengine/collider2d/callbacklayers.md) property.
* Normally both the [Collider2D](/engine/6000.6/script-reference/unityengine/collider2d.md) and the [Rigidbody2D](/engine/6000.6/script-reference/unityengine/rigidbody2d.md) it is attached to receive a callback therefore this option controls both those component callbacks.
* When enabling callback layers where callbacks already exist, those contacts will not be reported as new contacts i.e. there will not be an [OnCollisionEnter2D](/engine/6000.6/script-reference/unityengine/collider2d/oncollisionenter2d.md) or [OnTriggerEnter2D](/engine/6000.6/script-reference/unityengine/collider2d/ontriggerenter2d.md) callback produced.

Additional Resources: [LayerMask](/engine/6000.6/script-reference/unityengine/layermask.md).
