SGameObject
On this classSubscribeToEvents
- Functions
- Subscribe
To Events - Set
Sibling Index - Set
As First Sibling - Set
As Last Sibling - Duplicate
- Instantiate
- Add
Hinge Joint - Add
Light - Add
Animator - Add
Audio Source - Add
Clickable - Get
Script - Get
Scripts In Children - Get
Script In Children - Get
Script In Parent - Get
Events - Get
All Events In Children - Get
Events In Children - Get
Events In Parent - Get
Resources - Get
All Resources In Children - Get
Resources In Children - Get
Resources In Parent - Get
Data - Get
All Data In Children - Get
Data In Children - Get
Data In Parent - Add
Rigidbody - Add
Nav Mesh Agent - Add
Seat - On
Awake - On
Start - On
Enable - On
Disable - On
Fixed Update - On
Late Update - On
Trigger Start - On
Trigger Stay - On
Trigger Exit - On
Collision Enter - On
Collision Stay - On
Collision Exit - On
Particle Collision - On
Particle Trigger - On
Update - On
Mouse Down - On
Application Quit - Compare
Tag - Set
Parent - Find
- Find
In Children - Destroy
- Get
Component - Properties
- Owner
- LocalID
- InventoryID
- Has
StableID - GlobalID
- Exists
- Hinge
Joint - Light
- Reflection
Probe - Light
In Child - Light
In Parent - Animator
- Animation
- Canvas
Group - Audio
- Floor
- Voice
Zone - Browser
- Director
- Renderer
- Vehicle
- Post
Process Volume - Archimatix
- Clickable
- Embedded
Video - Avatar
- Avatar
Appearance - Script
- State
Machine - Networking
- Events
- Resources
- Data
- Rigidbody
- Collider
- Box
Collider - Sphere
Collider - Capsule
Collider - Wheel
Collider - Character
Controller - Audio
Reactive - Attachment
Helper - Audio
Reactive Animation - Audio
Reactive Light - Audio
Reactive Particle System - Audio
Reactive Material - Audio
Reactive Transform - Trail
Renderer - Line
Renderer - UI
Layout - UI
Toggle - UI
Dropdown - UI
Button - UI
Text - UI
Slider - UI
Scrollbar - UI
Canvas - UI
Image - UI
Raw Image - UI
Input Field - UI
Tool Tip Hint - Camera
- Virtual
Camera - Cloth
- Mesh
Renderer - Furniture
- Nav
Mesh Agent - Nav
Mesh Obstacle - Particle
System - Rect
Transform - Seat
- Skinned
Mesh Renderer - Radio
- Terrain
- Analytics
Event - Graphic
Raycaster - Content
Size Fitter - Active
- Active
Self - Layer
- Tag
- Name
- Moniker
- Parent
- Root
- Children
- World
Position - Local
Position - World
Rotation - Local
Rotation - Local
Scale - World
Scale - Forward
- Up
- Right
- Event
Calendar
| Function | SubscribeToEvents | Causes this script to start listening to events on the object. |
| Function | SetSiblingIndex | Sets the sibling index. |
| Function | SetAsFirstSibling | This GameObject becomes the first Sibling |
| Function | SetAsLastSibling | This GameObject becomes the last Sibling |
| Function | Duplicate | Copies the object and returns a reference to the copy. |
| Function | Instantiate | Copy of Duplicate() for convenience |
| Function | AddHingeJoint | Adds a Hinge Joint component to this Game Object and returns its reference |
| Function | AddLight | Adds a Light component to the object. |
| Function | AddAnimator | Adds an Animator component to this Game Object and returns its reference |
| Function | AddAudioSource | Adds an AudioSource component to the object. |
| Function | AddClickable | Adds a Clickable component to the object. |
| Function | GetScript | Returns a Scripting Runtime component attached to this object by Component Name, or nil if none exist |
| Function | GetScriptsInChildren | Returns Scripting Runtime components attached to this object by Component Name or its children |
| Function | GetScriptInChildren | Returns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist |
| Function | GetScriptInParent | Returns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist |
| Function | GetEvents | – |
| Function | GetAllEventsInChildren | – |
| Function | GetEventsInChildren | – |
| Function | GetEventsInParent | – |
| Function | GetResources | – |
| Function | GetAllResourcesInChildren | – |
| Function | GetResourcesInChildren | – |
| Function | GetResourcesInParent | – |
| Function | GetData | Returns a Scripting Data component attached to this object by Component Name, or nil if none exist |
| Function | GetAllDataInChildren | Returns Scripting Data components attached to this object by Component Name or its children |
| Function | GetDataInChildren | Returns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist |
| Function | GetDataInParent | Returns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist |
| Function | AddRigidbody | Adds a Rigidbody component to the object. |
| Function | AddNavMeshAgent | Adds a NavMeshAgent component to the object. |
| Function | AddSeat | Adds a Seat component to the object. |
| Function | OnAwake | Binds a event to the Awake() event. |
| Function | OnStart | Binds a event to the Start() event. |
| Function | OnEnable | Binds a event to the OnEnable() event. |
| Function | OnDisable | Binds a event to the OnDisable() event. |
| Function | OnFixedUpdate | Binds a event to the OnFixedUpdate() event. |
| Function | OnLateUpdate | Binds a event to the OnLateUpdate() event. |
| Function | OnTriggerStart | When a GameObject collides with another GameObject, Unity calls OnTriggerEnter. |
| Function | OnTriggerStay | OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger. |
| Function | OnTriggerExit | OnTriggerExit is called when the Collider other has stopped touching the trigger. |
| Function | OnCollisionEnter | OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. |
| Function | OnCollisionStay | OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. |
| Function | OnCollisionExit | OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. |
| Function | OnParticleCollision | OnParticleCollision is called when a particle hits a Collider. |
| Function | OnParticleTrigger | Binds a new event handler for the OnParticleTrigger event. |
| Function | OnUpdate | Binds a event to the OnUpdate() event. |
| Function | OnMouseDown | Binds a event to the OnMouseDown() event. |
| Function | OnApplicationQuit | Binds a new event handler for the On Application Quit event |
| Function | CompareTag | – |
| Function | SetParent | Make this GameObject the child of GameObject 'other' |
| Function | Find | Find and return a reference to GameObject with name 'name' |
| Function | FindInChildren | Find and return a reference to GameObject with name 'name' including children |
| Function | Destroy | Schedules this object for deletion at the end of the frame |
| Function | GetComponent | – |
| Property | Owner | Returns the GameObject's Owner |
| Property | LocalID | Returns the GameObject's Local ID |
| Property | InventoryID | Return's the GameObject's InventoryID |
| Property | HasStableID | Returns true if GameObject has Stable ID |
| Property | GlobalID | Returns the global ID of the GameObject |
| Property | Exists | Does this object still exist in the scene (returns false if the object has been deleted via Destroy();) |
| Property | HingeJoint | Returns a HingeJoint component attached to this object, or nil if none exist |
| Property | Light | Returns a reference to a Light component on the object. |
| Property | ReflectionProbe | Returns a ReflectionProbe component attached to this object, or nil if none exist |
| Property | LightInChild | Returns a Light component attached to this object or its children, or nil if none exist |
| Property | LightInParent | Returns a Light component attached to this object or it's parent, or nil if none exist |
| Property | Animator | Returns a reference to a Animator component on the object. |
| Property | Animation | 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 |
| Property | CanvasGroup | Returns Canvas Group component attached to this object, or nil if none exist |
| Property | Audio | Returns a reference to a AudioSource component on the object. |
| Property | Floor | Returns a RoomFloor component attached to this object, or nil if none exist |
| Property | VoiceZone | Returns a VoiceZone component attached to this object, or nil if none exist |
| Property | Browser | Returns a reference to a BrowserSurface component on the object. |
| Property | Director | Returns a PlayableDirector component attached to this object, or nil if none exist |
| Property | Renderer | Returns a reference to a Renderer component on the object. |
| Property | Vehicle | Returns a Modular Vehicle component attached to this object, or nil if none exist |
| Property | PostProcessVolume | Returns a Post Process Volume component attached to this object, or nil if none exist |
| Property | Archimatix | Returns a Archimatix Model ("AXModel" component) - or Nil if nothing exists |
| Property | Clickable | Returns a reference to a Clickable component on the object. |
| Property | EmbeddedVideo | Returns an Embedded Video component attached to this object, or nil if none exist (may not work within editor) |
| Property | Avatar | A reference to an Avatar component on the GameObject. |
| Property | AvatarAppearance | Returns a AvatarAppearance component attached to this object, or nil if none exist |
| Property | Script | Returns a Scripting Runtime component attached to this object, or nil if none exist |
| Property | StateMachine | Returns a State Machine component attached to this object, or nil if none exist |
| Property | Networking | Returns a Simple Networking component attached to this object, or nil if none exists |
| Property | Events | – |
| Property | Resources | – |
| Property | Data | Returns a Scripting Data component attached to this object, or nil if none exist |
| Property | Rigidbody | Returns a reference to a Rigidbody component on the object. |
| Property | Collider | Returns a reference to a Collider component on the object. |
| Property | BoxCollider | Returns a Box Collider component attached to this object, or nil if none exist |
| Property | SphereCollider | Returns a Sphere Collider component attached to this object, or nil if none exist |
| Property | CapsuleCollider | Returns a Capsule Collider component attached to this object, or nil if none exist |
| Property | WheelCollider | Returns a WheelCollider component attached to this object, or nil if none exist |
| Property | CharacterController | Returns a Character Controller component attached to this object, or nil if none exist |
| Property | AudioReactive | Returns the first Audio Reactive component attached to this object, or nil if none exist |
| Property | AttachmentHelper | Returns the first Attachment Helper component attached to this object, or nil if none exist |
| Property | AudioReactiveAnimation | Returns the first Audio Reactive Animation component attached to this object, or nil if none exist |
| Property | AudioReactiveLight | Returns the first Audio Reactive Light component attached to this object, or nil if none exist |
| Property | AudioReactiveParticleSystem | Returns the first Audio Reactive Particle System component attached to this object, or nil if none exist |
| Property | AudioReactiveMaterial | Returns the first Audio Reactive Material component attached to this object, or nil if none exist |
| Property | AudioReactiveTransform | Returns the first Audio Reactive Transform component attached to this object, or nil if none exist |
| Property | TrailRenderer | Returns a Trail Renderer component attached to this object, or nil if none exist |
| Property | LineRenderer | Returns a Line Renderer component attached to this object, or nil if none exist |
| Property | UILayout | Returns a Renderer component attached to this object, or nil if none exist |
| Property | UIToggle | Returns a Unity uGUI Toggle component attached to this object, or nil if none exist |
| Property | UIDropdown | Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist |
| Property | UIButton | Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist |
| Property | UIText | Returns a reference to a UI.Text component on the object. |
| Property | UISlider | Returns a Unity uGUI Slider component attached to this object, or nil if none exist |
| Property | UIScrollbar | Returns a Unity uGUI Scrollbar component attached to this object, or nil if none exist |
| Property | UICanvas | Returns a Unity uGUI Canvas component attached to this object, or nil if none exist |
| Property | UIImage | Returns a Unity uGUI Image component attached to this object, or nil if none exist |
| Property | UIRawImage | Returns a Unity uGUI Text component attached to this object, or nil if none exist |
| Property | UIInputField | Returns a Unity uGUI Text component attached to this object, or nil if none exist |
| Property | UIToolTipHint | – |
| Property | Camera | – |
| Property | VirtualCamera | Returns a VirtualCamera component attached to this object, or nil if none exists |
| Property | Cloth | Returns a Cloth component attached to this object, or nil if none exists |
| Property | MeshRenderer | Returns a MeshRenderer component attached to this object, or nil if none exists |
| Property | Furniture | Returns a Furniture component attached to this object, or nil if none exists |
| Property | NavMeshAgent | Adds a NavMeshAgent component to the object. |
| Property | NavMeshObstacle | Returns a NavMeshObstacle component attached to this object, or nil if none exists |
| Property | ParticleSystem | Returns a ParticleSystem component attached to this object, or nil if none exists |
| Property | RectTransform | Returns a RectTransform component attached to this object, or nil if none exists |
| Property | Seat | Returns a reference to a Seat component on the object. |
| Property | SkinnedMeshRenderer | Returns a SkinnedMeshRenderer component attached to this object, or nil if none exists |
| Property | Radio | Returns a SceneBackgroundMusic component attached to this object, or nil if none exists |
| Property | Terrain | Returns a Terrain component attached to this object, or nil if none exists |
| Property | AnalyticsEvent | – |
| Property | GraphicRaycaster | – |
| Property | ContentSizeFitter | – |
| Property | Active | Is this object Active in the scene |
| Property | ActiveSelf | Returns true if GameObject is Active (even if it's parent is not active) |
| Property | Layer | Gets/Sets the object onto a particular layer (0-31) |
| Property | Tag | Gets this objects Tag |
| Property | Name | Gets/sets the name of this object |
| Property | Moniker | – |
| Property | Parent | Gets/sets the parent GameObject of this object. |
| Property | Root | Gets the root of this object group - may be this object. |
| Property | Children | Returns the list of direct children of this object. |
| Property | WorldPosition | Gets or sets the current position of this object relative to the scene |
| Property | LocalPosition | Gets or sets the current position of this object relative to the objects parent, taking into account local position/scale/rotation |
| Property | WorldRotation | Gets or sets the current rotation of this object relative to the scene |
| Property | LocalRotation | Gets or sets the current rotation of this object relative to the parent object |
| Property | LocalScale | Gets or sets the current scale of this object relative to the parent |
| Property | WorldScale | Gets the current scale of this object relative to the scene |
| Property | Forward | Returns the forward direction vector of this game object (blue arrow) |
| Property | Up | Returns the up direction vector of this game object (green arrow) |
| Property | Right | Returns the right direction vector of this game object (red arrow) |
| Property | EventCalendar | Returns an EventCalendar component attached to this object, or nil if none exists |
Functions
SubscribeToEvents
Causes this script to start listening to events on the object.
Returns
void
Example
Space.Host.ExecutingObject.SubscribeToEvents()
SetSiblingIndex
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.
Parameters
| Name | Type | Default |
|---|---|---|
| newIndex | int | – |
Returns
void
Example
Space.Host.ExecutingObject.SetSiblingIndex(2)
SetAsFirstSibling
This GameObject becomes the first Sibling
Returns
void
Example
Space.Host.ExecutingObject.SetAsFirstSibling()
SetAsLastSibling
This GameObject becomes the last Sibling
Returns
void
Example
Space.Host.ExecutingObject.SetAsLastSibling()
Duplicate
Copies the object and returns a reference to the copy. Equivalent to calling Instantiate() in Unity
Returns
SGameObject
Example
local copy = Space.Host.ExecutingObject.Duplicate()
--this script will make this object, once clicked, duplicate itself, then the duplicate
--moves up and then duplicate itself again and the duplicate move down (total 3 vertically aligned)
--(Example: cells multiplying)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
local firstDuplicate = thisGameObject.Duplicate()
firstDuplicate.WorldPosition = firstDuplicate.WorldPosition + firstDuplicate.Up
local secondDuplicate = thisGameObject.Duplicate()
secondDuplicate.WorldPosition = secondDuplicate.WorldPosition - secondDuplicate.Up
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to watch me multiply "
thisGameObject.Clickable.OnClick(OnClick)
Instantiate
Copy of Duplicate() for convenience
Returns
SGameObject
Example
NewGameObject = Space.Host.ExecutingObject.Instantiate()
--this script will make this object, once clicked, duplicate itself, then the duplicate
--moves up and then duplicate itself again and the duplicate move down (total 3 vertically aligned)
--(Example: cells multiplying)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
local firstDuplicate = thisGameObject.Instantiate()
firstDuplicate.WorldPosition = firstDuplicate.WorldPosition + firstDuplicate.Up
local secondDuplicate = thisGameObject.Instantiate()
secondDuplicate.WorldPosition = secondDuplicate.WorldPosition - secondDuplicate.Up
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to watch me multiply "
thisGameObject.Clickable.OnClick(OnClick)
AddHingeJoint
Adds a Hinge Joint component to this Game Object and returns its reference
Returns
SHingeJoint
Example
NewHingeJoint = Space.Host.ExecutingObject.AddHingeJoint()
--clicking this object will add a Hinge Joint component to it at runtime
thisObject = Space.Host.ExecutingObject
OnClick = function()
HJ = thisObject.AddHingeJoint()
end
thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
AddLight
Adds a Light component to the object.
Returns
SLight
Example
newLightComponent = Space.Host.ExecutingObject.AddLight()
AddAnimator
Adds an Animator component to this Game Object and returns its reference
Returns
SAnimator
Example
NewAnimator = Space.Host.ExecutingObject.AddAnimator()
--clicking this object will add an animator to it and controller at runtime
thisObject = Space.Host.ExecutingObject
theResource = Space.GetResource("An Animator Controller") -- add controller to resources in Scripting Runtime
OnClick = function()
Animator = thisObject.AddAnimator()
Animator.Controller = theResource
end
thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
AddAudioSource
Adds an AudioSource component to the object.
Returns
SAudioSource
Example
newAudioSourceComponent = Space.Host.ExecutingObject.AddAudioSource()
AddClickable
Adds a Clickable component to the object.
Returns
SClickable
Example
newClikcableComponent = Space.Host.ExecutingObject.AddClickable()
GetScript
Returns a Scripting Runtime component attached to this object by Component Name, or nil if none exist
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingRuntime
Example
scriptingRuntime = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")
GetScriptsInChildren
Returns Scripting Runtime components attached to this object by Component Name or its children
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
List< SScriptingRuntime >
Example
tableScriptsInChildren = Space.Host.ExecutingObject.GetScriptsInChildren("scriptingruntimecomponentname",true)
GetScriptInChildren
Returns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
SScriptingRuntime
Example
scriptingRuntimeInChildren = Space.Host.ExecutingObject.GetScriptInChildren("scriptingruntimecomponentname",true)
GetScriptInParent
Returns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingRuntime
Example
scriptingRuntimeInParent = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")
GetEvents
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingEvents
Example
scriptingEvent = Space.Host.ExecutingObject.GetEvents('ScriptingEventsComponentName')
GetAllEventsInChildren
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
List< SScriptingEvents >
Example
tableScriptingEvent = Space.Host.ExecutingObject.GetAllEventsInChildren
GetEventsInChildren
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
SScriptingEvents
Example
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName')
--or
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName', true)
GetEventsInParent
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingEvents
Example
scriptingEvent = Space.Host.ExecutingObject.GetEventsInParent('ScriptingEventsComponentName')
GetResources
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingResources
Example
Space.Host.ExecutingObject.GetResources('ResourcesComponentName')
GetAllResourcesInChildren
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
List< SScriptingResources >
Example
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName', true)
GetResourcesInChildren
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
SScriptingResources
Example
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName', true)
GetResourcesInParent
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingResources
Example
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInParent('ScriptingResourcesComponentName')
GetData
Returns a Scripting Data component attached to this object by Component Name, or nil if none exist
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingData
Example
scriptingData = Space.Host.ExecutingObject.GetData("scriptingdatacomponentname")
GetAllDataInChildren
Returns Scripting Data components attached to this object by Component Name or its children
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
List< SScriptingData >
Example
tableScriptingDataInChildren = Space.Host.ExecutingObject.GetAllDataInChildren("scriptingdatacomponentname",true)
GetDataInChildren
Returns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
Returns
SScriptingData
Example
scriptingDataInChildren = Space.Host.ExecutingObject.GetDataInChildren("scriptingdatacomponentname",true)
GetDataInParent
Returns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SScriptingData
Example
scriptingDataInParent = Space.Host.ExecutingObject.GetDataInParent("scriptingdatacomponentname")
AddRigidbody
Adds a Rigidbody component to the object.
Returns
SRigidbody
Example
newRigibodyComponent = Space.Host.ExecutingObject.AddRigidbody()
AddNavMeshAgent
Adds a NavMeshAgent component to the object.
Returns
SNavMeshAgent
Example
newNavMeshAgentComponent = Space.Host.ExecutingObject.AddNavMeshAgent()
AddSeat
Adds a Seat component to the object.
Returns
SSeat
Example
newSeatComponent = Space.Host.ExecutingObject.AddSeat()
OnAwake
Binds a event to the Awake() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnAwake(F)
OnStart
Binds a event to the Start() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnStart(F)
OnEnable
Binds a event to the OnEnable() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnEnable(F)
OnDisable
Binds a event to the OnDisable() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnDisable(F)
OnFixedUpdate
Binds a event to the OnFixedUpdate() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnFixedUpdate(F)
--this script will make this object move forward each physics frame
thisObject = Space.Host.ExecutingObject
OnFixedUpdate = function()
thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 )
--unlike OnUpdate we did not multiply by Space.DeltaTime
--because OnFixedUpdate executes at the same rate regardless
end
thisObject.OnFixedUpdate(OnFixedUpdate)
OnLateUpdate
Binds a event to the OnLateUpdate() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnLateUpdate(F)
--this script will make this object move forward each frame
--but it will be last to move among other objects (read about OnLateUpdate)
--(example: camera movement)
thisObject = Space.Host.ExecutingObject
OnLateUpdate = function()
thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 * Space.DeltaTime)
--we multipy by Space.DeltaTime so that it behaves the same for all players
--even though they have different FPS (frames per second)
end
thisObject.OnLateUpdate(OnLateUpdate)
OnTriggerStart
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnTriggerStart = function(SGameObject)
Space.Log("Trigger Start")
end
this.OnTriggerStart (OnTriggerStart )
--the below scipt makes this object a boundary area where flying gets blocked
--while player is in it and flying is allowed once player leaves it
--(Example: No fly zone)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
OnTriggerStart = function(TriggerStarter)
if TriggerStarter.Root.Avatar ~= nil then
if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = true
end
end
end
OnTriggerExit = function(TriggerExiter)
if TriggerExiter.Root.Avatar ~= nil then
if TriggerExiter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = false
end
end
end
thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerExit(OnTriggerExit)
OnTriggerStay
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnTriggerStay = function(SGameObject)
Space.Log("Trigger Stay")
end
this.OnTriggerStay(OnTriggerStay)
--the below scipt makes this object a boundary area where any user entering it
--will be blocked from movement for 10 seconds, then the object will release controls and
--destry itself after that
--(Example: freezing trap)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
FrozenTime = 0.0
OnTriggerStart = function(TriggerStarter)
if TriggerStarter.Root.Avatar ~= nil then
if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockMovement = true
end
end
end
OnTriggerStay = function(TriggerStayer)
if TriggerStayer.Root.Avatar ~= nil then
if TriggerStayer.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
FrozenTime = FrozenTime + Space.DeltaTime
if FrozenTime > 20 then
Space.Scene.PlayerAvatar.BlockMovement = false
thisGameObject.Destroy()
end
end
end
end
thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerStay(OnTriggerStay)
OnTriggerExit
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnTriggerExit = function(SGameObject)
Space.Log("Trigger Stay")
end
this.OnTriggerExit(OnTriggerExit)
--the below scipt makes this object a boundary area where flying gets blocked
--while player is in it and flying is allowed once player leaves it
--(Example: No fly zone)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
OnTriggerStart = function(TriggerStarter)
if TriggerStarter.Root.Avatar ~= nil then
if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = true
end
end
end
OnTriggerExit = function(TriggerExiter)
if TriggerExiter.Root.Avatar ~= nil then
if TriggerExiter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = false
end
end
end
thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerExit(OnTriggerExit)
OnCollisionEnter
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Action< SPhysicsHit > | – |
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnCollisionEnter = function(SPhysicsHit)
Space.Log("Collision Enter")
end
this.OnCollisionEnter(OnCollisionEnter)
--this script will make this object delete itself if it collides with something
--(Example: grenade)
--[Make sure you add a rigibody to this object (read above about "collisions")
thisGameObject = Space.Host.ExecutingObject
OnCollisionEnter = function(SPhysicsHit)
thisGameObject.Destroy()
end
thisGameObject.OnCollisionEnter(OnCollisionEnter)
OnCollisionStay
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Action< SPhysicsHit > | – |
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnCollisionStay = function(SPhysicsHit)
Space.Log("Collision Stay")
end
this.OnCollisionStay(OnCollisionStay)
--this script will make this object delete itself if
--it is being touched for around 10 seconds
--(Example: a flag being captured)
--[Make sure this object has collider/rigidbody (read above about "collisions" for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
touchedTime = 0.0
OnCollisionStay = function(SPhysicsHit)
touchedTime = touchedTime + Space.DeltaTime
if touchedTime > 25 then
thisGameObject.Destroy()
end
end
thisGameObject.OnCollisionStay(OnCollisionStay)
OnCollisionExit
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Action< SPhysicsHit > | – |
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnCollisionExit = function(SPhysicsHit)
Space.Log("Collision Exit")
end
this.OnCollisionExit(OnCollisionExit)
--this script will make this object destroy itself when an object
--that collided with it exits the collission
--(Example: landmine)
--[Make sure you add a rigibody to this object (read above about "collisions")
thisGameObject = Space.Host.ExecutingObject
OnCollisionExit = function(SPhysicsHit)
thisGameObject.Destroy()
end
thisGameObject.OnCollisionExit(OnCollisionExit)
OnParticleCollision
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnParticleCollision = function(GameObject)
Space.Log("Particle Collision")
end
this.OnParticleCollision(OnParticleCollision)
OnParticleTrigger
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.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnParticleTrigger = function(GameObject)
Space.Log("Particle Trigger Event")
end
this.OnParticleTrigger(OnParticleTrigger)
OnUpdate
Binds a event to the OnUpdate() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnUpdate(F)
--this script will make this object move forward each frame
thisObject = Space.Host.ExecutingObject
OnUpdate = function()
thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 * Space.DeltaTime)
--we multipy by Space.DeltaTime so that it behaves the same for all players
--even though they have different FPS (frames per second)
end
thisObject.OnUpdate(OnUpdate)
OnMouseDown
Binds a event to the OnMouseDown() event.
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnMouseDown(F)
OnApplicationQuit
Binds a new event handler for the On Application Quit event
Parameters
| Name | Type | Default |
|---|---|---|
| e | Closure | – |
Returns
void
Example
this = Space.Host.ExecutingObject
OnApplicationQuit = function()
Space.Log("Application Quit")
end
this.OnApplicationQuit(OnApplicationQuit)
CompareTag
Parameters
| Name | Type | Default |
|---|---|---|
| tag | string | – |
Returns
bool
Example
isSame = Space.Host.ExecutingObject.CompareTag('tagname')
SetParent
Make this GameObject the child of GameObject 'other'
Parameters
| Name | Type | Default |
|---|---|---|
| other | SGameObject | – |
| worldPositionStays | bool | true |
Returns
void
Example
Space.Host.ExecutingObject.SetParent(otherObjectReference,true)
--this script will set your avatar's "right hand" as parent of this object
--this way this object will be a child of your right hand and therefore move with it
--(Example: clicking on a gun to equip it)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
RightHand = Space.Scene.PlayerAvatar.FindBone("RightHand")
thisGameObject.SetParent(RightHand)
thisGameObject.LocalPosition = Vector.New(0,0,0) -- resetting position to match hand
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to Equip "
thisGameObject.Clickable.OnClick(OnClick)
Find
Find and return a reference to GameObject with name 'name'
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SGameObject
Example
FoundObject = Space.Host.ExecutingObject.Find("GameObject Name")
FindInChildren
Find and return a reference to GameObject with name 'name' including children
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SGameObject
Example
FoundObjectInChildren = Space.Host.ExecutingObject.FindInChildren("GameObject Name")
Destroy
Schedules this object for deletion at the end of the frame
Returns
void
Example
Space.Host.ExecutingObject.Destroy()
GetComponent
Parameters
| Name | Type | Default |
|---|---|---|
| name | string | – |
Returns
SComponent
Properties
OwnerRead only
Returns the GameObject's Owner
Example
Owner = Space.Host.ExecutingObject.Owner
LocalIDRead only
Returns the GameObject's Local ID
Example
LocalID = Space.Host.ExecutingObject.LocalID
InventoryIDRead only
Return's the GameObject's InventoryID
Example
InventoryID = Space.Host.ExecutingObject.InventoryID
HasStableIDRead only
Returns true if GameObject has Stable ID
Example
HasStableID = Space.Host.ExecutingObject.HasStableID
GlobalIDRead only
Returns the global ID of the GameObject
Example
GlobalID = Space.Host.ExecutingObject.GlobalID
ExistsRead only
Does this object still exist in the scene (returns false if the object has been deleted via Destroy();)
Example
doesExist = Space.Host.ExecutingObject.Exists
HingeJointRead only
Returns a HingeJoint component attached to this object, or nil if none exist
Example
HingeJoint = Space.Host.ExecutingObject.HingeJoint
LightRead only
Returns a reference to a Light component on the object. Will return null if it does not exist.
Example
newLightComponent = Space.Host.ExecutingObject.Light
ReflectionProbeRead only
Returns a ReflectionProbe component attached to this object, or nil if none exist
Example
ReflectionProbe = Space.Host.ExecutingObject.ReflectionProbe
LightInChildRead only
Returns a Light component attached to this object or its children, or nil if none exist
Example
LightInChild = Space.Host.ExecutingObject.LightInChild
LightInParentRead only
Returns a Light component attached to this object or it's parent, or nil if none exist
Example
LightInParent = Space.Host.ExecutingObject.LightInParent
AnimatorRead only
Returns a reference to a Animator component on the object. Will return null if it does not exist.
Example
animatorComponent = Space.Host.ExecutingObject.Animator
AnimationRead only
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
Example
Animation = Space.Host.ExecutingObject.Animation
CanvasGroupRead only
Returns Canvas Group component attached to this object, or nil if none exist
Example
CanvasGroup = Space.Host.ExecutingObject.CanvasGroup
AudioRead only
Returns a reference to a AudioSource component on the object. Will return null if it does not exist.
Example
newAudioComponent = Space.Host.ExecutingObject.Audio
FloorRead only
Returns a RoomFloor component attached to this object, or nil if none exist
Example
Floor = Space.Host.ExecutingObject.Floor
VoiceZoneRead only
Returns a VoiceZone component attached to this object, or nil if none exist
Example
VoiceZone = Space.Host.ExecutingObject.VoiceZone
BrowserRead only
Returns a reference to a BrowserSurface component on the object. Will return null if it does not exist.
Example
newBrowserComponent = Space.Host.ExecutingObject.Browser
DirectorRead only
Returns a PlayableDirector component attached to this object, or nil if none exist
Example
Director = Space.Host.ExecutingObject.Director
RendererRead only
Returns a reference to a Renderer component on the object. Will return null if it does not exist.
Example
renderer = Space.Host.ExecutingObject.Renderer
VehicleRead only
Returns a Modular Vehicle component attached to this object, or nil if none exist
Example
Vehicle = Space.Host.ExecutingObject.Vehicle
PostProcessVolumeRead only
Returns a Post Process Volume component attached to this object, or nil if none exist
Example
PostProcessVolume = Space.Host.ExecutingObject.PostProcessVolume
ArchimatixRead only
Returns a Archimatix Model ("AXModel" component) - or Nil if nothing exists
Example
Archimatix = Space.Host.ExecutingObject.Archimatix
ClickableRead only
Returns a reference to a Clickable component on the object. Will return null if it does not exist.
Example
clickableComponent = Space.Host.ExecutingObject.Clickable
EmbeddedVideoRead only
Returns an Embedded Video component attached to this object, or nil if none exist (may not work within editor)
Example
EmbeddedVideo = Space.Host.ExecutingObject.EmbeddedVideo
AvatarRead only
A reference to an Avatar component on the GameObject.
Example
Avatar = Space.Host.ExecutingObject.Avatar
AvatarAppearanceRead only
Returns a AvatarAppearance component attached to this object, or nil if none exist
Example
AvatarAppearance = Space.Host.ExecutingObject.AvatarAppearance
ScriptRead only
Returns a Scripting Runtime component attached to this object, or nil if none exist
Example
Script = Space.Host.ExecutingObject.Script
StateMachineRead only
Returns a State Machine component attached to this object, or nil if none exist
Example
StateMachine = Space.Host.ExecutingObject.StateMachine
NetworkingRead only
Returns a Simple Networking component attached to this object, or nil if none exists
Example
SimpleNetworking = Space.Host.ExecutingObject.Networking
EventsRead only
Example
eventsComponent = Space.Host.ExecutingObject.Events
ResourcesRead only
Example
resourcesComponent = Space.Host.ExecutingObject.Resources
DataRead only
Returns a Scripting Data component attached to this object, or nil if none exist
Example
Data = Space.Host.ExecutingObject.Data
RigidbodyRead only
Returns a reference to a Rigidbody component on the object. Will return null if it does not exist.
Example
rigidbodyComponent = Space.Host.ExecutingObject.Rigidbody
ColliderRead only
Returns a reference to a Collider component on the object. Will return null if it does not exist.
Example
colliderComponent = Space.Host.ExecutingObject.Collider
BoxColliderRead only
Returns a Box Collider component attached to this object, or nil if none exist
Example
BoxCollider = Space.Host.ExecutingObject.BoxCollider
SphereColliderRead only
Returns a Sphere Collider component attached to this object, or nil if none exist
Example
SphereCollider = Space.Host.ExecutingObject.SphereCollider
CapsuleColliderRead only
Returns a Capsule Collider component attached to this object, or nil if none exist
Example
CapsuleCollider = Space.Host.ExecutingObject.CapsuleCollider
WheelColliderRead only
Returns a WheelCollider component attached to this object, or nil if none exist
Example
WheelCollider = Space.Host.ExecutingObject.WheelCollider
CharacterControllerRead only
Returns a Character Controller component attached to this object, or nil if none exist
Example
CharacterController = Space.Host.ExecutingObject.CharacterController
AudioReactiveRead only
Returns the first Audio Reactive component attached to this object, or nil if none exist
Example
AudioReactive = Space.Host.ExecutingObject.AudioReactive
AttachmentHelperRead only
Returns the first Attachment Helper component attached to this object, or nil if none exist
Example
AttachmentHelper = Space.Host.ExecutingObject.AttachmentHelper
AudioReactiveAnimationRead only
Returns the first Audio Reactive Animation component attached to this object, or nil if none exist
Example
AudioReactiveAnimation = Space.Host.ExecutingObject.AudioReactiveAnimation
AudioReactiveLightRead only
Returns the first Audio Reactive Light component attached to this object, or nil if none exist
Example
AudioReactiveLight = Space.Host.ExecutingObject.AudioReactiveLight
AudioReactiveParticleSystemRead only
Returns the first Audio Reactive Particle System component attached to this object, or nil if none exist
Example
AudioReactiveParticleSystem = Space.Host.ExecutingObject.AudioReactiveParticleSystem
AudioReactiveMaterialRead only
Returns the first Audio Reactive Material component attached to this object, or nil if none exist
Example
AudioReactiveMaterial = Space.Host.ExecutingObject.AudioReactiveMaterial
AudioReactiveTransformRead only
Returns the first Audio Reactive Transform component attached to this object, or nil if none exist
Example
AudioReactiveTransform = Space.Host.ExecutingObject.AudioReactiveTransform
TrailRendererRead only
Returns a Trail Renderer component attached to this object, or nil if none exist
Example
TrailRenderer = Space.Host.ExecutingObject.TrailRenderer
LineRendererRead only
Returns a Line Renderer component attached to this object, or nil if none exist
Example
LineRenderer = Space.Host.ExecutingObject.LineRenderer
UILayoutRead only
Returns a Renderer component attached to this object, or nil if none exist
Example
UILayout = Space.Host.ExecutingObject.UILayout
UIToggleRead only
Returns a Unity uGUI Toggle component attached to this object, or nil if none exist
Example
UIToggle = Space.Host.ExecutingObject.UIToggle
UIDropdownRead only
Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist
Example
UIDropdown = Space.Host.ExecutingObject.UIDropdown
UIButtonRead only
Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist
Example
UIButton = Space.Host.ExecutingObject.UIButton
UITextRead only
Returns a reference to a UI.Text component on the object. Will return null if it does not exist.
Example
uitext = Space.Host.ExecutingObject.UIText
UISliderRead only
Returns a Unity uGUI Slider component attached to this object, or nil if none exist
Example
UISlider = Space.Host.ExecutingObject.UISlider
UIScrollbarRead only
Returns a Unity uGUI Scrollbar component attached to this object, or nil if none exist
Example
UIScrollbar = Space.Host.ExecutingObject.UIScrollbar
UICanvasRead only
Returns a Unity uGUI Canvas component attached to this object, or nil if none exist
Example
UICanvas = Space.Host.ExecutingObject.UICanvas
UIImageRead only
Returns a Unity uGUI Image component attached to this object, or nil if none exist
Example
UIImage = Space.Host.ExecutingObject.UIImage
UIRawImageRead only
Returns a Unity uGUI Text component attached to this object, or nil if none exist
Example
UIRawImage = Space.Host.ExecutingObject.UIRawImage
UIInputFieldRead only
Returns a Unity uGUI Text component attached to this object, or nil if none exist
Example
UIInputField = Space.Host.ExecutingObject.UIInputField
UIToolTipHintRead only
Example
tooltipHint = Space.Host.ExecutingObject.UIToolTipHint
CameraRead only
Example
camera = Space.Host.ExecutingObject.Camera
VirtualCameraRead only
Returns a VirtualCamera component attached to this object, or nil if none exists
Example
VirtualCamera = Space.Host.ExecutingObject.VirtualCamera
ClothRead only
Returns a Cloth component attached to this object, or nil if none exists
Example
Cloth = Space.Host.ExecutingObject.Cloth
MeshRendererRead only
Returns a MeshRenderer component attached to this object, or nil if none exists
Example
MeshRenderer = Space.Host.ExecutingObject.MeshRenderer
FurnitureRead only
Returns a Furniture component attached to this object, or nil if none exists
Example
Furniture = Space.Host.ExecutingObject.Furniture
NavMeshAgentRead only
Adds a NavMeshAgent component to the object.
Example
navMeshAgent = Space.Host.ExecutingObject.AddNavMeshAgent()
NavMeshObstacleRead only
Returns a NavMeshObstacle component attached to this object, or nil if none exists
Example
NavMeshObstacle = Space.Host.ExecutingObject.NavMeshObstacle
ParticleSystemRead only
Returns a ParticleSystem component attached to this object, or nil if none exists
Example
ParticleSystem = Space.Host.ExecutingObject.ParticleSystem
RectTransformRead only
Returns a RectTransform component attached to this object, or nil if none exists
Example
RectTransform = Space.Host.ExecutingObject.RectTransform
SeatRead only
Returns a reference to a Seat component on the object. Will return null if it does not exist.
Example
seatComponent = Space.Host.ExecutingObject.AddSeat()
SkinnedMeshRendererRead only
Returns a SkinnedMeshRenderer component attached to this object, or nil if none exists
Example
SkinnedMeshRenderer = Space.Host.ExecutingObject.SkinnedMeshRenderer
RadioRead only
Returns a SceneBackgroundMusic component attached to this object, or nil if none exists
Example
Radio = Space.Host.ExecutingObject.Radio
TerrainRead only
Returns a Terrain component attached to this object, or nil if none exists
Example
Terrain = Space.Host.ExecutingObject.Terrain
AnalyticsEventRead only
Example
analyticsEvent = Space.Host.ExecutingObject.AnalyticsEvent
GraphicRaycasterRead only
Example
graphicRaycaster = Space.Host.ExecutingObject.GraphicRaycaster
ContentSizeFitterRead only
Example
contentSzeFitter = Space.Host.ExecutingObject.ContentSizeFitter
Active
Is this object Active in the scene
Example
Space.Host.ExecutingObject.Active = false
--the below script will make this object become inactive
--after being being clicked
--(Example: picking up fruits)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
thisGameObject.Active = false
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Pick me!"
thisGameObject.Clickable.OnClick(OnClick)
ActiveSelf
Returns true if GameObject is Active (even if it's parent is not active)
Example
Space.Host.ExecutingObject.ActiveSelf = false
Layer
Gets/Sets the object onto a particular layer (0-31)
Example
Space.Host.ExecutingObject.Layer = 21
TagRead only
Gets this objects Tag
Example
objectTag = Space.Host.ExecutingObject.Tag
Name
Gets/sets the name of this object
Example
Space.Host.ExecutingObject.Name = 'Hello World!'
Moniker
Example
Space.Host.ExecutingObject.Moniker = 'New Moniker'
Parent
Gets/sets the parent GameObject of this object. Assign nil/null to set this as the root.
Example
Space.Host.ExecutingObject.Parent = Space.Host.GetReference("TheOtherObject")
RootRead only
Gets the root of this object group - may be this object.
Example
objectRoot = Space.Host.ExecutingObject.Root
ChildrenRead only
Returns the list of direct children of this object.
Example
tableChildren = Space.Host.ExecutingObject.Children
WorldPosition
Gets or sets the current position of this object relative to the scene
Example
Space.Host.ExecutingObject.WorldPosition = Vector.New(1,1,1)
LocalPosition
Gets or sets the current position of this object relative to the objects parent, taking into account local position/scale/rotation
Example
Space.Host.ExecutingObject.LocalPosition = Vector.New(1,1,1)
WorldRotation
Gets or sets the current rotation of this object relative to the scene
Example
Space.Host.ExecutingObject.WorldRotation = Quaternion.Euler(0,180,0)
LocalRotation
Gets or sets the current rotation of this object relative to the parent object
Example
Space.Host.ExecutingObject.LocalRotation = Quaternion.Euler(0,180,0)
LocalScale
Gets or sets the current scale of this object relative to the parent
Example
Space.Host.ExecutingObject.LocalScale = Vector.New(2,2,2)
WorldScaleRead only
Gets the current scale of this object relative to the scene
Example
worldScale = Space.Host.ExecutingObject.WorldScale
ForwardRead only
Returns the forward direction vector of this game object (blue arrow)
Example
vectorForward = Space.Host.ExecutingObject.Forward
UpRead only
Returns the up direction vector of this game object (green arrow)
Example
vectorUp = Space.Host.ExecutingObject.Up
RightRead only
Returns the right direction vector of this game object (red arrow)
Example
vectorRight = Space.Host.ExecutingObject.Right
EventCalendarRead only
Returns an EventCalendar component attached to this object, or nil if none exists
Example
EventCalendar = Space.Host.ExecutingObject.EventCalendar



