Version: 2022.1
public Collider collider ;

描述

被该控制器撞击的碰撞体。

using UnityEngine;

public class Example : MonoBehaviour { void OnControllerColliderHit(ControllerColliderHit hit) { // Call a damage function on the object we hit. hit.gameObject.SendMessage("ApplyDamage", 5); } }