Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


transform

The transform that was hit by the controller.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
public Transform transform { get; }

Examples

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