SGameObject

Functions

SubscribeToEvents

void SubscribeToEvents ()

Causes this script to start listening to events on the object.

This function is now automatically called by events that require it

Space.Host.ExecutingObject.SubscribeToEvents()

SetSiblingIndex

void SetSiblingIndex (int newIndex)

Sets the sibling index.

Use this to change the sibling index of the GameObject. If a GameObject shares a parent with other GameObjects and are on the same level (i.e. they share the same direct parent), these GameObjects are known as siblings. The sibling index shows where each GameObject sits in this sibling hierarchy.

Use SetSiblingIndex to change the GameObject’s place in this hierarchy. When the sibling index of a GameObject is changed, its order in the Hierarchy window will also change.

Parameter
Type
Description

Space.Host.ExecutingObject.SetSiblingIndex(2)

SetAsFirstSibling

void SetAsFirstSibling ()

This GameObject becomes the first Sibling

SetAsLastSibling

void SetAsLastSibling ()

This GameObject becomes the last Sibling

Duplicate

SGameObject Duplicate ()

Copies the object and returns a reference to the copy. Equivalent to calling Instantiate() in Unity

Instantiate

SGameObject Instantiate ()

Copy of Duplicate() for convenience

AddHingeJoint

SHingeJoint AddHingeJoint ()

Adds a Hinge Joint component to this Game Object and returns its reference

AddLight

SLight AddLight ()

Adds a Light component to the object.

AddAnimator

SAnimator AddAnimator ()

Adds an Animator component to this Game Object and returns its reference

AddAudioSource

SAudioSource AddAudioSource ()

Adds an AudioSource component to the object.

AddClickable

SClickable AddClickable ()

Adds a Clickable component to the object.

GetScript

SScriptingRuntime GetScript (string name)

Returns a Scripting Runtime component attached to this object by Component Name, or nil if none exist

Parameter
Type
Description

GetScriptsInChildren

List< SScriptingRuntime > GetScriptsInChildren (string name, bool includeInactive=false)

Returns Scripting Runtime components attached to this object by Component Name or its children

Parameter
Type
Description

GetScriptInChildren

SScriptingRuntime GetScriptInChildren (string name, bool includeInactive=false)

Returns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist

Parameter
Type
Description

GetScriptInParent

SScriptingRuntime GetScriptInParent (string name)

Returns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist

Parameter
Type
Description

GetEvents

SScriptingEvents GetEvents (string name)

Function Description

Parameter
Type
Description

name

string

GetAllEventsInChildren

List< SScriptingEvents > GetAllEventsInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetEventsInChildren

SScriptingEvents GetEventsInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetEventsInParent

SScriptingEvents GetEventsInParent (string name)

Function Description

Parameter
Type
Description

GetResources

SScriptingResources GetResources (string name)

Function Description

Parameter
Type
Description

GetAllResourcesInChildren

List< SScriptingResources > GetAllResourcesInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetResourcesInChildren

SScriptingResources GetResourcesInChildren (string name, bool includeInactive=false)

Function Description

Parameter
Type
Description

GetResourcesInParent

SScriptingResources GetResourcesInParent (string name)

Function Description

Parameter
Type
Description

GetData

SScriptingData GetData (string name)

Returns a Scripting Data component attached to this object by Component Name, or nil if none exist

Parameter
Type
Description

GetAllDataInChildren

List< SScriptingData > GetAllDataInChildren (string name, bool includeInactive=false)

Returns Scripting Data components attached to this object by Component Name or its children

Parameter
Type
Description

GetDataInChildren

SScriptingData GetDataInChildren (string name, bool includeInactive=false)

Returns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist

Parameter
Type
Description

GetDataInParent

SScriptingData GetDataInParent (string name)

Returns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist

Parameter
Type
Description

AddRigidbody

SRigidbody AddRigidbody ()

Adds a Rigidbody component to the object.

AddNavMeshAgent

SNavMeshAgent AddNavMeshAgent ()

Adds a NavMeshAgent component to the object.

AddSeat

SSeat AddSeat ()

Adds a Seat component to the object.

OnAwake

void OnAwake (Closure e)

Binds a event to the Awake() event.

Parameter
Type
Description

OnStart

void OnStart (Closure e)

Binds a event to the Start() event.

Parameter
Type
Description

OnEnable

void OnEnable (Closure e)

Binds a event to the OnEnable() event.

Parameter
Type
Description

OnDisable

void OnDisable (Closure e)

Binds a event to the OnDisable() event.

Parameter
Type
Description

OnFixedUpdate

void OnFixedUpdate (Closure e)

Binds a event to the OnFixedUpdate() event.

Parameter
Type
Description

OnLateUpdate

void OnLateUpdate (Closure e)

Binds a event to the OnLateUpdate() event.

Parameter
Type
Description

OnTriggerStart

void OnTriggerStart (Action< SGameObject > e) void OnTriggerStart (Closure e)

When a GameObject collides with another GameObject, Unity calls OnTriggerEnter.

OnTriggerEnter happens on the FixedUpdate function when two GameObjects collide. The Colliders involved are not always at the point of initial contact.

Note: Both GameObjects must contain a Collider component. One must have Collider.isTrigger enabled, and contain a Rigidbody. If both GameObjects have Collider.isTrigger enabled, no collision happens. The same applies when both GameObjects do not have a Rigidbody component.

Parameter
Type
Description

OnTriggerStay

void OnTriggerStay (Action< SGameObject > e) void OnTriggerStay (Closure e)

OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger. The function is on the physics timer so it won't necessarily run every frame.

This message is sent to the trigger and the collider that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

Parameter
Type
Description

OnTriggerExit

void OnTriggerExit (Action< SGameObject > e) void OnTriggerExit (Closure e)

OnTriggerExit is called when the Collider other has stopped touching the trigger.

This message is sent to the trigger and the Collider that touches the trigger. Notes: Trigger events are only sent if one of the Colliders also has a Rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions. OnTriggerExit occurs on the FixedUpdate after the Colliders have stopped touching. The Colliders involved are not guaranteed to be at the point of initial separation.

Parameter
Type
Description

OnCollisionEnter

void OnCollisionEnter (Action< SPhysicsHit > e) void OnCollisionEnter (Closure e)

OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.

In contrast to OnTriggerStart, OnCollisionEnter is passed the SPhysicsHit class and not a Collider (GameObject). The SPhysicsHit class contains information, for example, about contact points and impact velocity. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

Parameter
Type
Description

OnCollisionStay

void OnCollisionStay (Action< SPhysicsHit > e) void OnCollisionStay (Closure e)

OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.

In contrast to OnTriggerStay, OnCollisionStay is passed the SPhysicsHit class and not a Collider (GameObject). The SPhysicsHit class contains information about contact points, impact velocity etc. If you don't use collisionInfo in the function, leave out the collisionInfo parameter as this avoids unneccessary calculations. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions. Collision stay events are not sent for sleeping Rigidbodies.

Parameter
Type
Description

OnCollisionExit

void OnCollisionExit (Action< SPhysicsHit > e) void OnCollisionExit (Closure e)

OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.

In contrast to OnTriggerExit, OnCollisionExit is passed the SPhysicsHit class and not a Collider. The SPhysicsHit class contains information about contact points, impact velocity etc. If you don't use collisionInfo in the function, leave out the collisionInfo parameter as this avoids unneccessary calculations. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.

Parameter
Type
Description

OnParticleCollision

void OnParticleCollision (Action< SGameObject > e) void OnParticleCollision (Closure e)

OnParticleCollision is called when a particle hits a Collider.

This can be used to apply damage to a GameObject when hit by particles.

This message is sent to scripts attached to Particle Systems and to the Collider that was hit.

When OnParticleCollision is invoked from a script attached to a GameObject with a Collider, the GameObject parameter represents the ParticleSystem. The Collider receives at most one message per Particle System that collided with it in any given frame even when the Particle System struck the Collider with multiple particles in the current frame.

When OnParticleCollision is invoked from a script attached to a ParticleSystem, the GameObject parameter represents a GameObject with an attached Collider struck by the ParticleSystem. The ParticleSystem receives at most one message per Collider that is struck.

Messages are only sent if you enable Send Collision Messages in the Inspector of the Particle System Collision module.

The OnParticleCollision can be a co-routine. Simply use the yield statement in the function.

Parameter
Type
Description

OnParticleTrigger

void OnParticleTrigger (Closure e)

Binds a new event handler for the OnParticleTrigger event.

OnParticleTrigger event is called when any particles in a Particle System meet the conditions in the trigger module.

This can be used to kill or modify particles that are inside or outside a collision volume.

Parameter
Type
Description

OnUpdate

void OnUpdate (Closure e)

Binds a event to the OnUpdate() event.

Parameter
Type
Description

OnMouseDown

void OnMouseDown (Closure e)

Binds a event to the OnMouseDown() event.

Parameter
Type
Description

OnApplicationQuit

void OnApplicationQuit (Closure e)

Binds a new event handler for the On Application Quit event

Parameter
Type
Description

CompareTag

bool CompareTag (string tag)

Function Description

Parameter
Type
Description

SetParent

void SetParent (SGameObject other, bool worldPositionStays=true)

Make this GameObject the child of GameObject 'other'

Parameter
Type
Description

Find

SGameObject Find (string name)

Find and return a reference to GameObject with name 'name'

Parameter
Type
Description

FindInChildren

SGameObject FindInChildren (string name)

Find and return a reference to GameObject with name 'name' including children

Parameter
Type
Description

Destroy

void Destroy ()

Schedules this object for deletion at the end of the frame

GetComponent

SComponent GetComponent (string name)

Properties

Owner

long Owner get

Returns the GameObject's Owner

LocalID

int LocalID get

Returns the GameObject's Local ID

InventoryID

int InventoryID get

Return's the GameObject's InventoryID

HasStableID

bool HasStableID get

Returns true if GameObject has Stable ID

GlobalID

string? GlobalID get

Returns the global ID of the GameObject

Exists

bool Exists get

Does this object still exist in the scene (returns false if the object has been deleted via Destroy();)

HingeJoint

SHingeJoint HingeJoint get

Returns a HingeJoint component attached to this object, or nil if none exist

Light

SLight Light get

Returns a reference to a Light component on the object. Will return null if it does not exist.

ReflectionProbe

SReflectionProbe ReflectionProbe get

Returns a ReflectionProbe component attached to this object, or nil if none exist

LightInChild

SLight LightInChildget

Returns a Light component attached to this object or its children, or nil if none exist

LightInParent

SLight LightInParent get

Returns a Light component attached to this object or it's parent, or nil if none exist

Animator

SAnimator Animator get

Returns a reference to a Animator component on the object. Will return null if it does not exist.

Animation

SAnimation Animation get

Returns an Animation component attached to this object, or nil if none exist Animation is a legacy component and should not be confused with Animator

CanvasGroup

SCanvasGroup CanvasGroup get

Returns Canvas Group component attached to this object, or nil if none exist

Audio

SAudioSource Audio get

Returns a reference to a AudioSource component on the object. Will return null if it does not exist.

Floor

SRoomFloor Floor get

Returns a RoomFloor component attached to this object, or nil if none exist

VoiceZone

SVoiceZone VoiceZone get

Returns a VoiceZone component attached to this object, or nil if none exist

Browser

SBrowserSurface Browser get

Returns a reference to a BrowserSurface component on the object. Will return null if it does not exist.

Director

SPlayableDirector Director get

Returns a PlayableDirector component attached to this object, or nil if none exist

Renderer

SRenderer Renderer get

Returns a reference to a Renderer component on the object. Will return null if it does not exist.

Vehicle

SModularVehicle Vehicle get

Returns a Modular Vehicle component attached to this object, or nil if none exist

PostProcessVolume

SPostProcessVolume PostProcessVolume get

Returns a Post Process Volume component attached to this object, or nil if none exist

Archimatix

SAXModel Archimatix get

Returns a Archimatix Model ("AXModel" component) - or Nil if nothing exists

Clickable

SClickable Clickable get

Returns a reference to a Clickable component on the object. Will return null if it does not exist.

EmbeddedVideo

SEmbeddedVideo EmbeddedVideo get

Returns an Embedded Video component attached to this object, or nil if none exist (may not work within editor)

Avatar

SAvatar Avatar get

A reference to an Avatar component on the GameObject.

AvatarAppearance

SAvatarAppearance AvatarAppearance get

Returns a AvatarAppearance component attached to this object, or nil if none exist

Script

SScriptingRuntime Script get

Returns a Scripting Runtime component attached to this object, or nil if none exist

StateMachine

SStateMachine StateMachine get

Returns a State Machine component attached to this object, or nil if none exist

Networking

SNetworking Networking get

Returns a Simple Networking component attached to this object, or nil if none exists

Events

SScriptingEvents Events get

Property Description

Resources

SScriptingResources Resources get

Property Description

Data

SScriptingData Data get

Returns a Scripting Data component attached to this object, or nil if none exist

Rigidbody

SRigidbody Rigidbody get

Returns a reference to a Rigidbody component on the object. Will return null if it does not exist.

Collider

SCollider Collider get

Returns a reference to a Collider component on the object. Will return null if it does not exist.

BoxCollider

SBoxCollider BoxCollider get

Returns a Box Collider component attached to this object, or nil if none exist

SphereCollider

SSphereCollider SphereCollider get

Returns a Sphere Collider component attached to this object, or nil if none exist

CapsuleCollider

SCapsuleCollider CapsuleCollider get

Returns a Capsule Collider component attached to this object, or nil if none exist

WheelCollider

SWheelCollider WheelCollider get

Returns a WheelCollider component attached to this object, or nil if none exist

CharacterController

SCharacterController CharacterController get

Returns a Character Controller component attached to this object, or nil if none exist

AudioReactive

SAudioReactiveBase AudioReactive get

Returns the first Audio Reactive component attached to this object, or nil if none exist

AttachmentHelper

SAttachmentHelper AttachmentHelper get

Returns the first Attachment Helper component attached to this object, or nil if none exist

AudioReactiveAnimation

SAudioReactiveAnimation AudioReactiveAnimation get

Returns the first Audio Reactive Animation component attached to this object, or nil if none exist

AudioReactiveLight

SAudioReactiveLight AudioReactiveLight get

Returns the first Audio Reactive Light component attached to this object, or nil if none exist

AudioReactiveParticleSystem

SAudioReactiveParticleSystem AudioReactiveParticleSystem get

Returns the first Audio Reactive Particle System component attached to this object, or nil if none exist

AudioReactiveMaterial

SAudioReactiveMaterial AudioReactiveMaterial get

Returns the first Audio Reactive Material component attached to this object, or nil if none exist

AudioReactiveTransform

SAudioReactiveTransform AudioReactiveTransform get

Returns the first Audio Reactive Transform component attached to this object, or nil if none exist

TrailRenderer

STrailRenderer TrailRenderer get

Returns a Trail Renderer component attached to this object, or nil if none exist

LineRenderer

SLineRenderer LineRenderer get

Returns a Line Renderer component attached to this object, or nil if none exist

UILayout

SUILayout UILayout get

Returns a Renderer component attached to this object, or nil if none exist

UIToggle

SUIToggle UIToggle get

Returns a Unity uGUI Toggle component attached to this object, or nil if none exist

UIDropdown

SUIDropdown UIDropdown get

Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist

UIButton

SUIButton UIButton get

Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist

UIText

SUIText UIText get

Returns a reference to a UI.Text component on the object. Will return null if it does not exist.

UISlider

SUISlider UISlider get

Returns a Unity uGUI Slider component attached to this object, or nil if none exist

UIScrollbar

SUIScrollbar UIScrollbar get

Returns a Unity uGUI Scrollbar component attached to this object, or nil if none exist

UICanvas

SUICanvas UICanvas get

Returns a Unity uGUI Canvas component attached to this object, or nil if none exist

UIImage

SUIImage UIImage get

Returns a Unity uGUI Image component attached to this object, or nil if none exist

UIRawImage

SUIRawImage UIRawImage get

Returns a Unity uGUI Text component attached to this object, or nil if none exist

UIInputField

SUIInputField UIInputField get

Returns a Unity uGUI Text component attached to this object, or nil if none exist

UIToolTipHint

SUIToolTipHint UIToolTipHint get

Property Description

Camera

SCamera Camera get

Property Description

VirtualCamera

SVirtualCamera VirtualCamera get

Returns a VirtualCamera component attached to this object, or nil if none exists

Cloth

SCloth Cloth get

Returns a Cloth component attached to this object, or nil if none exists

MeshRenderer

SMeshRenderer MeshRenderer get

Returns a MeshRenderer component attached to this object, or nil if none exists

Furniture

SFurniture Furniture get

Returns a Furniture component attached to this object, or nil if none exists

SNavMeshAgent NavMeshAgent get

Adds a NavMeshAgent component to the object.

SNavMeshObstacle NavMeshObstacle get

Returns a NavMeshObstacle component attached to this object, or nil if none exists

ParticleSystem

SParticleSystem ParticleSystem get

Returns a ParticleSystem component attached to this object, or nil if none exists

RectTransform

SRectTransform RectTransform get

Returns a RectTransform component attached to this object, or nil if none exists

Seat

SSeat Seat get

Returns a reference to a Seat component on the object. Will return null if it does not exist.

SkinnedMeshRenderer

SSkinnedMeshRenderer SkinnedMeshRenderer get

Returns a SkinnedMeshRenderer component attached to this object, or nil if none exists

Radio

SSceneBackgroundMusic Radio get

Returns a SceneBackgroundMusic component attached to this object, or nil if none exists

Terrain

STerrain Terrain get

Returns a Terrain component attached to this object, or nil if none exists

AnalyticsEvent

SAnalyticsEvent AnalyticsEvent get

Property Description

GraphicRaycaster

SGraphicRaycaster GraphicRaycaster get

Property Description

ContentSizeFitter

SContentSizeFitter ContentSizeFitter get

Property Description

Active

bool Active get set

Is this object Active in the scene

ActiveSelf

bool ActiveSelf get set

Returns true if GameObject is Active (even if it's parent is not active)

Layer

int Layer get set

Gets/Sets the object onto a particular layer (0-31)

Tag

string Tag get

Gets this objects Tag

Name

string Name get set

Gets/sets the name of this object

Moniker

string? Moniker get set

Property Description

Parent

SGameObject Parent get set

Gets/sets the parent GameObject of this object. Assign nil/null to set this as the root.

Root

SGameObject Root get

Gets the root of this object group - may be this object.

Children

SGameObject[] Children get

Returns the list of direct children of this object.

WorldPosition

SVector WorldPosition get set

Gets or sets the current position of this object relative to the scene

LocalPosition

SVector LocalPosition get set

Gets or sets the current position of this object relative to the objects parent, taking into account local position/scale/rotation

WorldRotation

SQuaternion WorldRotation get set

Gets or sets the current rotation of this object relative to the scene

LocalRotation

SQuaternion LocalRotation get set

Gets or sets the current rotation of this object relative to the parent object

LocalScale

SVector LocalScale get set

Gets or sets the current scale of this object relative to the parent

WorldScale

SVector WorldScale get

Gets the current scale of this object relative to the scene

Forward

SVector Forward get

Returns the forward direction vector of this game object (blue arrow)

Up

SVector Up get

Returns the up direction vector of this game object (green arrow)

SVector Right get

Returns the right direction vector of this game object (red arrow)

EventCalendar

SEventCalendar EventCalendar get

Returns an EventCalendar component attached to this object, or nil if none exists

Last updated

Was this helpful?