Documentation

Unity Engine

Download Unity

Unity Engine

gameObject

The game object that was hit by the controller.
Read time 1 minuteLast updated 6 hours ago

Definition

public GameObject gameObject { get; }

Examples

using UnityEngine;public class Example : MonoBehaviour{ void OnControllerColliderHit(ControllerColliderHit hit) { // Objects we touch, move them to position (0, 0, 0) hit.gameObject.transform.position = Vector3.zero; }}