Skip to content

GameObject

The fundamental object in every Unity scene. In VRChat worlds, GameObjects hold all components like meshes, colliders, audio sources, and Udon behaviours, and toggling them on or off is one of the most common operations.

Properties

PropertyTypeAccess
activeInHierarchyboolget
activeSelfboolget
gameObjectGameObjectget
isStaticboolget, set
layerintget, set
namestringget, set
transformTransformget

activeSelf

Whether this GameObject is locally active (ignores parent state).

let isOn: bool = gameObject.activeSelf

layer

The layer index this GameObject is on, used for physics and rendering masks.

let l: int = gameObject.layer

name

The name of the GameObject as shown in the hierarchy.

log("Object name: {gameObject.name}")

transform

The Transform component attached to this GameObject.

let pos: Vector3 = gameObject.transform.position

Methods

Equals

Equals(other: object) -> bool

Find

static Find(name: string) -> GameObject

Static method that finds a GameObject by name in the scene. Expensive; cache the result.

let obj: GameObject = GameObject.Find("SpawnPoint")

GetComponent

GetComponent(type: string) -> UnityEngineComponent
GetComponent(type: SystemType) -> UnityEngineComponent
GetComponent(type: SystemType) -> UnityEngineObject

Returns a component of the given type attached to this GameObject.

let rb: Rigidbody = gameObject.GetComponent()

GetComponentInChildren

GetComponentInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObject
GetComponentInChildren(type: SystemType, includeInactive: bool) -> UnityEngineComponent
GetComponentInChildren(type: SystemType) -> UnityEngineComponent
GetComponentInChildren(type: SystemType) -> UnityEngineObject

GetComponentInParent

GetComponentInParent(includeInactive: bool, type: SystemType) -> UnityEngineObject
GetComponentInParent(type: SystemType, includeInactive: bool) -> UnityEngineComponent
GetComponentInParent(type: SystemType) -> UnityEngineComponent
GetComponentInParent(type: SystemType) -> UnityEngineObject

GetComponents

GetComponents(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> void
GetComponents(type: SystemType, results: SystemCollectionsGenericList`1[[UnityEngineComponent, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> void
GetComponents(type: SystemType) -> UnityEngineComponent[]
GetComponents(type: SystemType) -> UnityEngineObject[]

GetComponentsInChildren

GetComponentsInChildren(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> void
GetComponentsInChildren(includeInactive: bool, results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> void
GetComponentsInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObject[]
GetComponentsInChildren(type: SystemType, includeInactive: bool) -> UnityEngineComponent[]
GetComponentsInChildren(type: SystemType) -> UnityEngineComponent[]
GetComponentsInChildren(type: SystemType) -> UnityEngineObject[]

GetComponentsInParent

GetComponentsInParent(includeInactive: bool, results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> void
GetComponentsInParent(includeInactive: bool, type: SystemType) -> UnityEngineObject[]
GetComponentsInParent(type: SystemType, includeInactive: bool) -> UnityEngineComponent[]
GetComponentsInParent(type: SystemType) -> UnityEngineComponent[]
GetComponentsInParent(type: SystemType) -> UnityEngineObject[]

GetHashCode

GetHashCode() -> int

GetInstanceID

GetInstanceID() -> int

GetType

GetType() -> SystemType

SetActive

SetActive(value: bool) -> void

Enables or disables the GameObject in the scene.

gameObject.SetActive(true)

ToString

ToString() -> string