collider
The incoming Collider2D involved in the collision with the Collision2D.otherCollider.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.Physics2DModule
public Collider2D collider { get; }
Remarks
This collider is attached to the Collision2D.rigidbody.
Additional Resources: Collider2D and Rigidbody2D.
Examples
using UnityEngine;using System.Collections;public class ExampleClass : MonoBehaviour{ void OnCollisionEnter2D(Collision2D coll) { // If the Collider2D component is enabled on the collided object if (coll.collider == true) { // Disables the Collider2D component coll.collider.enabled = false; } }}