Version: 2017.3
public Collider2D collider ;

描述

otherCollider 的碰撞中涉及的传入 Collider2D

该碰撞体附加到 Collision2D.rigidbody

另请参阅:Collider2DRigidbody2D

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; } } }