Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


gameObject

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

Definition

  • Type: Property
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
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; }}