Version: 2021.3
public Transform transform ;

描述

被该控制器撞击的变换组件。

using UnityEngine;

public class Example : MonoBehaviour { // Print the transform's name that collided with this ControllerCollider void OnControllerColliderHit(ControllerColliderHit hit) { if (hit != null) { Debug.Log("I'm colliding with: " + hit.transform.name); } } }