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
| Property | Type | Access |
|---|---|---|
| activeInHierarchy | bool | get |
| activeSelf | bool | get |
| gameObject | GameObject | get |
| isStatic | bool | get, set |
| layer | int | get, set |
| name | string | get, set |
| transform | Transform | get |
activeSelf
Whether this GameObject is locally active (ignores parent state).
let isOn: bool = gameObject.activeSelflayer
The layer index this GameObject is on, used for physics and rendering masks.
let l: int = gameObject.layername
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.positionMethods
Equals
Equals(other: object) -> boolFind
static Find(name: string) -> GameObjectStatic method that finds a GameObject by name in the scene. Expensive; cache the result.
let obj: GameObject = GameObject.Find("SpawnPoint")GetComponent
GetComponent(type: string) -> UnityEngineComponentGetComponent(type: SystemType) -> UnityEngineComponentGetComponent(type: SystemType) -> UnityEngineObjectReturns a component of the given type attached to this GameObject.
let rb: Rigidbody = gameObject.GetComponent()GetComponentInChildren
GetComponentInChildren(includeInactive: bool, type: SystemType) -> UnityEngineObjectGetComponentInChildren(type: SystemType, includeInactive: bool) -> UnityEngineComponentGetComponentInChildren(type: SystemType) -> UnityEngineComponentGetComponentInChildren(type: SystemType) -> UnityEngineObjectGetComponentInParent
GetComponentInParent(includeInactive: bool, type: SystemType) -> UnityEngineObjectGetComponentInParent(type: SystemType, includeInactive: bool) -> UnityEngineComponentGetComponentInParent(type: SystemType) -> UnityEngineComponentGetComponentInParent(type: SystemType) -> UnityEngineObjectGetComponents
GetComponents(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> voidGetComponents(type: SystemType, results: SystemCollectionsGenericList`1[[UnityEngineComponent, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> voidGetComponents(type: SystemType) -> UnityEngineComponent[]GetComponents(type: SystemType) -> UnityEngineObject[]GetComponentsInChildren
GetComponentsInChildren(results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]], type: SystemType) -> voidGetComponentsInChildren(includeInactive: bool, results: SystemCollectionsGenericList`1[[UnityEngineObject, UnityEngineCoreModule, Version=0000, Culture=neutral, PublicKeyToken=null]]) -> voidGetComponentsInChildren(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]]) -> voidGetComponentsInParent(includeInactive: bool, type: SystemType) -> UnityEngineObject[]GetComponentsInParent(type: SystemType, includeInactive: bool) -> UnityEngineComponent[]GetComponentsInParent(type: SystemType) -> UnityEngineComponent[]GetComponentsInParent(type: SystemType) -> UnityEngineObject[]GetHashCode
GetHashCode() -> intGetInstanceID
GetInstanceID() -> intGetType
GetType() -> SystemTypeSetActive
SetActive(value: bool) -> voidEnables or disables the GameObject in the scene.
gameObject.SetActive(true)ToString
ToString() -> string