wiki.sine.space | sinespace

Difference between revisions of "Scripting/SGameObject"

From wiki.sine.space
Jump to: navigation, search
(Replaced content with "This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/sgameobject")
 
(29 intermediate revisions by the same user not shown)
Line 1: Line 1:
The SGameObject class refers a single Game Object active within the scene.
+
This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/sgameobject
 
+
=Public Member Functions=
+
 
+
 
+
{{ScriptFunction|SGameObject|Duplicate|();|Copies the object and returns a reference to the copy. Equivalent to calling Instantiate() in Unity|5= local copy = Space.Host.ExecutingObject.Duplicate()|6= <pre>
+
--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)
+
</pre>}}
+
 
+
 
+
 
+
{{ScriptFunction|void|Destroy|();|Schedules this object for deletion at the end of the frame|Space.Host.ExecutingObject.Destroy()|6= <pre>
+
--this script will make this object destroy itself if it collides with something
+
--(Example: grenade or bullet)
+
--[Make sure you add a rigibody to this object (read above about "collisions")
+
 
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
 
+
 
+
OnCollisionEnter = function(SPhysicsHit)
+
thisGameObject.Destroy()
+
end
+
 
+
thisGameObject.SubscribeToEvents()
+
thisGameObject.OnCollisionEnter(OnCollisionEnter) </pre>}}
+
 
+
 
+
{{ScriptFunction|SLight|AddLight|()|Adds a Light component to the object.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Light component to the object if there is none''<br>
+
if obj.Light == null then<br>
+
:obj.AddLight();<br>
+
end<br><br>
+
Space.Log(obj.Light);<br>
+
''-- prints "SLight" to the console. Now we can work with the Light component on this object.''}}
+
 
+
 
+
{{ScriptFunction|SAudioSource|AddAudioSource|()|Adds an AudioSource component to the object.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the AudioSource component to the object if there is none''<br>
+
if obj.Audio == null then<br>
+
:obj.AddAudioSource();<br>
+
end<br><br>
+
Space.Log(obj.Audio);<br>
+
''-- prints "SAudioSource" to the console. Now we can work with the AudioSource component on this object.''}}
+
 
+
 
+
{{ScriptFunction|SClickable|AddClickable|()|Adds a Clickable component to the object.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Clickable component to the object if there is none''<br>
+
if obj.Clickable == null then<br>
+
:obj.AddClickable();<br>
+
end<br><br>
+
Space.Log(obj.Clickable);<br>
+
''-- prints "SClickable" to the console. Now we can work with the Clickable component on this object.''}}
+
 
+
 
+
{{ScriptFunction|SRigidbody|AddRigidbody|()|Adds a Rigidbody component to the object.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Rigidbody component to the object if there is none''<br>
+
if obj.Rigidbody == null then<br>
+
:obj.AddRigidbody();<br>
+
end<br><br>
+
Space.Log(obj.Rigidbody);<br>
+
''-- prints "SRigidbody" to the console. Now we can work with the Rigidbody component on this object.''}}
+
 
+
 
+
{{ScriptFunction|SNavMeshAgent|AddNavMeshAgent|()|Adds a NavMeshAgent component to the object.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the NavMeshAgent component to the object if there is none''<br>
+
if obj.NavMeshAgent == null then<br>
+
:obj.AddNavMeshAgent();<br>
+
end<br><br>
+
Space.Log(obj.NavMeshAgent);<br>
+
''-- prints "SNavMeshAgent" to the console. Now we can work with the NavMeshAgent component on this object.''}}
+
 
+
 
+
{{ScriptFunction|SSeat|AddSeat|()|Adds a Seat component to the object.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Seat component to the object if there is none''<br>
+
if obj.Seat == null then<br>
+
:obj.AddSeat();<br>
+
end<br><br>
+
Space.Log(obj.Seat);<br>
+
''-- prints "SSeat" to the console. Now we can work with the Seat component on this object.''}}
+
 
+
 
+
 
+
 
+
{{ScriptFunction|void|SubscribeToEvents|();|Causes this script to start listening to events on the object. Only use if you need to.|5=<pre>Space.Host.ExecutingObject.SubscribeToEvents()</pre>}}
+
 
+
{{ScriptFunction|void|OnAwake|(Action callback)|Binds a event to the Awake() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnAwake(F)</pre>}}
+
 
+
{{ScriptFunction|void|OnStart|(Action callback)|Binds a event to the Start() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnStart(F)</pre>}}
+
 
+
{{ScriptFunction|void|OnEnable|(Action callback)|Binds a event to the OnEnable() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnEnable(F)</pre>}}
+
 
+
{{ScriptFunction|void|OnDisable|(Action callback)|Binds a event to the OnDisable() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnDisable(F)</pre>}}
+
 
+
{{ScriptFunction|void|OnFixedUpdate|(Action callback)|Binds a event to the OnFixedUpdate() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnFixedUpdate(F)</pre>}}
+
 
+
{{ScriptFunction|void|OnLateUpdate|(Action callback)|Binds a event to the OnLateUpdate() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnLateUpdate(F)</pre>}}
+
 
+
{{ScriptFunction|void|OnUpdate|(Action callback)|Binds a event to the OnUpdate() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnUpdate(F)</pre>}}
+
 
+
{{ScriptFunction|void|OnMouseDown|(Action callback)|Binds a event to the OnMouseDown() event. Requires SubscribeToEvents be called first.|5=<pre>function F()
+
Space.Log("bound")
+
end
+
Space.Host.ExecutingObject.SubscribeToEvents()
+
Space.Host.ExecutingObject.OnMouseDown(F)</pre>}}
+
 
+
 
+
{{ScriptFunction|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.|5=<pre>Space.Host.ExecutingObject.SetSiblingIndex(2)</pre>}}
+
 
+
 
+
{{ScriptFunction|void|SetAsFirstSibling|()|This GameObject becomes the first Sibling|5=<pre>Space.Host.ExecutingObject.SetAsFirstSibling()</pre>}}
+
 
+
 
+
{{ScriptFunction|void|SetAsLastSibling|()|This GameObject becomes the last Sibling|5=<pre>Space.Host.ExecutingObject.SetAsLastSibling()</pre>}}
+
 
+
 
+
{{ScriptFunction|SGameObject|Instantiate|()|Copy of Duplicate() for convenience|5=<pre>NewGameObject = Space.Host.ExecutingObject.Instantiate()</pre>}}
+
 
+
 
+
{{ScriptFunction|SHingeJoint|AddHingeJoint|()|Adds a Hinge Joint component to this Game Object and returns its reference|5=<pre>NewHingeJoint = Space.Host.ExecutingObject.AddHingeJoint()</pre>}}
+
 
+
{{ScriptFunction|SAnimator|AddAnimator|()|Adds an Animator component to this Game Object and returns its reference|5=<pre>NewAnimator = Space.Host.ExecutingObject.AddAnimator()</pre>}}
+
 
+
 
+
{{ScriptFunction|SScriptingRuntime|GetScript|(string name)|Returns a Scripting Runtime component attached to this object by Component Name, or nil if none exist|5=<pre>scriptingRuntime = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")</pre>}}
+
 
+
 
+
{{ScriptFunction|List< SScriptingRuntime >|GetScriptsInChildren|(string name, bool includeInactive)|Returns Scripting Runtime components attached to this object by Component Name or its children|5=<pre>tableScriptsInChildren = Space.Host.ExecutingObject.GetScriptsInChildren("scriptingruntimecomponentname",true)</pre>}}
+
 
+
 
+
{{ScriptFunction|SScriptingRuntime|GetScriptInChildren|(string name, bool includeInactive)|Returns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist|5=<pre>scriptingRuntimeInChildren = Space.Host.ExecutingObject.GetScriptInChildren("scriptingruntimecomponentname",true)</pre>}}
+
 
+
 
+
{{ScriptFunction|SScriptingRuntime|GetScriptInParent|(string name)|Returns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist|5=<pre>scriptingRuntimeInParent = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")</pre>}}
+
 
+
 
+
{{ScriptFunction|SScriptingData|GetData|(string name)|Returns a Scripting Data component attached to this object by Component Name, or nil if none exist|5=<pre>scriptingData = Space.Host.ExecutingObject.GetData("scriptingdatacomponentname")</pre>}}
+
 
+
 
+
{{ScriptFunction|List< SScriptingData >|GetAllDataInChildren|(string name, bool includeInactive)|Returns Scripting Data components attached to this object by Component Name or its children|5=<pre>tableScriptingDataInChildren = Space.Host.ExecutingObject.GetAllDataInChildren("scriptingdatacomponentname",true)</pre>}}
+
 
+
 
+
{{ScriptFunction|SScriptingData|GetDataInChildren|(string name, bool includeInactive)|Returns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist|5=<pre>scriptingDataInChildren = Space.Host.ExecutingObject.GetDataInChildren("scriptingdatacomponentname",true)</pre>}}
+
 
+
 
+
{{ScriptFunction|SScriptingData|GetDataInParent|(string name)|Returns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist|5=<pre>scriptingDataInParent = Space.Host.ExecutingObject.GetDataInParent("scriptingdatacomponentname")</pre>}}
+
 
+
 
+
{{ScriptFunction|void|OnTriggerStart|(Action< SGameObject > 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.|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnTriggerStart  = function(SGameObject)
+
Space.Log("Trigger Start")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnTriggerStart (OnTriggerStart )</pre>}}
+
 
+
 
+
{{ScriptFunction|void|OnTriggerStay|(Action< SGameObject > 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.|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnTriggerStay  = function(SGameObject)
+
Space.Log("Trigger Stay")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnTriggerStay(OnTriggerStay)</pre>}}
+
 
+
 
+
{{ScriptFunction|void|OnTriggerExit|(Action< SGameObject > 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.|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnTriggerExit  = function(SGameObject)
+
Space.Log("Trigger Stay")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnTriggerExit(OnTriggerExit)</pre>}}
+
 
+
 
+
{{ScriptFunction|void|OnCollisionEnter|(Action< SPhysicsHit > e)|OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
+
 
+
In contrast to OnTriggerEnter, 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.|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnCollisionEnter = function(SPhysicsHit)
+
Space.Log("Collision Enter")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnCollisionEnter(OnCollisionEnter)</pre>|6= <pre> --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.SubscribeToEvents()
+
thisGameObject.OnCollisionEnter(OnCollisionEnter) </pre>}}
+
 
+
 
+
{{ScriptFunction|void|OnCollisionStay|(Action< SPhysicsHit > 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.|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnCollisionStay = function(SPhysicsHit)
+
Space.Log("Collision Stay")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnCollisionStay(OnCollisionStay)</pre>}}
+
 
+
 
+
{{ScriptFunction|void|OnCollisionExit|(Action< SPhysicsHit > 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.|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnCollisionExit = function(SPhysicsHit)
+
Space.Log("Collision Exit")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnCollisionExit(OnCollisionExit)</pre>|6=<pre>
+
--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.SubscribeToEvents()
+
thisGameObject.OnCollisionExit(OnCollisionExit)
+
 
+
</pre>}}
+
 
+
 
+
{{ScriptFunction|void|OnParticleCollision|(Action< SGameObject > 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.|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnParticleCollision = function(GameObject)
+
Space.Log("Particle Collision")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnParticleCollision(OnParticleCollision)</pre>}}
+
 
+
 
+
 
+
{{ScriptFunction|void|OnParticleTrigger|(Action< SGameObject > 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.|5=<pre>
+
this = Space.Host.ExecutingObject
+
 
+
OnParticleTrigger = function(GameObject)
+
Space.Log("Particle Trigger Event")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnParticleTrigger(OnParticleTrigger)
+
 
+
</pre>}}
+
 
+
 
+
 
+
 
+
 
+
{{ScriptFunction|void|OnApplicationQuit|(Action e)|Binds a new event handler for the On Application Quit event|5=<pre>this = Space.Host.ExecutingObject
+
 
+
OnApplicationQuit = function()
+
Space.Log("Application Quit")
+
end
+
 
+
this.SubscribeToEvents()
+
this.OnApplicationQuit(OnApplicationQuit)</pre>}}
+
 
+
 
+
{{ScriptFunction|void|SetParent|(SGameObject other, bool worldPositionStays)|Make this GameObject the child of GameObject 'other'|5=<pre>Space.Host.ExecutingObject.SetParent(otherObjectReference,true)</pre>|6= <pre>
+
--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)
+
 
+
 
+
 
+
</pre>}}
+
 
+
 
+
{{ScriptFunction|SGameObject|Find|(string name)|Find and return a reference to GameObject with name 'name'|5=<pre>FoundObject = Space.Host.ExecutingObject.Find("GameObject Name")</pre>}}
+
 
+
 
+
{{ScriptFunction|SGameObject|FindInChildren|(string name)|Find and return a reference to GameObject with name 'name' including children|5=<pre>FoundObjectInChildren = Space.Host.ExecutingObject.FindInChildren("GameObject Name")</pre>|6=<pre>
+
--this script will search throughout it's heirarchy of children and find the specific
+
-- object we need for us which is useful if the heirarchy is deep and complicated
+
-- and much better than going through like .Children[1].Children[2].Children[1]... etc...
+
--(Example: clicking on a house toggles it's lights on and off)
+
--[Requires 4 children, doesn't matter heirarchy position, named Light1, Light2, Light3, Light4]
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
LightsAreOn = false
+
 
+
 
+
OpenDoor = function()
+
thisGameObject.FindInChildren("Light1").Active = false
+
thisGameObject.FindInChildren("Light2").Active = false
+
thisGameObject.FindInChildren("Light3").Active = false
+
thisGameObject.FindInChildren("Light4").Active = false
+
LightsAreOn = true
+
end
+
 
+
CloseDoor = function()
+
thisGameObject.FindInChildren("Light1").Active = true
+
thisGameObject.FindInChildren("Light2").Active = true
+
thisGameObject.FindInChildren("Light3").Active = true
+
thisGameObject.FindInChildren("Light4").Active = true
+
LightsAreOn = false
+
end
+
 
+
 
+
OnClick = function()
+
    if LightsAreOn then
+
      TurnLightsOff()
+
    else
+
      TurnLightsOn()
+
    end
+
end
+
 
+
thisGameObject.AddClickable()
+
thisGameObject.Clickable.Tooltip="Toggle Lights"
+
thisGameObject.Clickable.OnClick(OnClick)</pre>}}
+
 
+
 
+
{{ScriptFunction|SComponent|GetComponent|(string name)|Return a reference to component with component name 'name' or nil if it doesn't exist|5=<pre>FoundComponent = Space.Host.ExecutingObject.GetComponent("Component Name")</pre>}}
+
 
+
 
+
 
+
 
+
=Properties=
+
 
+
{{ScriptFunction|bool|Active|{ get; set; }|Is this object Active in the scene|5= Space.Host.ExecutingObject..Active = false|6=<pre>
+
--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)</pre>}}
+
 
+
{{ScriptFunction|int|Layer|{ get; set; }|Gets/Sets the object onto a particular layer (0-31)|Space.Log("This object is on the layer " .. Object.Layer);}}
+
 
+
{{ScriptFunction|string|Tag|{ get; }|Gets this objects Tag|Space.Log("Object Tag is " .. Object.Tag);}}
+
 
+
{{ScriptFunction|string|Name|{ get; set; }|Gets/sets the name of this object|5= Object.Name = "Hello World!";}}
+
 
+
{{ScriptFunction|bool|Exists|{ get; }|Does this object still exist in the scene (returns false if the object has been deleted via Destroy();)|if(!Object.Exists) return;}}
+
 
+
{{ScriptFunction|SGameObject|Parent|{ get; set; }|Gets/sets the parent GameObject of this object. Assign nil/null to set this as the root.|5=
+
''-- For this example, 2 separate Game Objects ("Cube", "Cube (1)") are used.''<br>
+
''-- This Scripting Runtime is the component of the "Cube" object.''<br>
+
''-- 1 Object Reference is used: Name: Cube1, references "Cube (1)".'' <br><br>
+
local obj = Space.Host.ExecutingObject;<br><br>
+
obj.Parent = Space.Host.GetReference("Cube1");<br>
+
''-- Now "Cube (1)" is the parent of "Cube" (can be observed in Hierarchy).''}}
+
 
+
{{ScriptFunction|SGameObject|Root|{ get; }|Gets the root of this object group - may be this object.|5=
+
''-- For this example, 3 separate Game Objects ("Cube", "Cube (1)", "Cube (2)") are used.''<br>
+
''-- "Cube" is the parent of "Cube (1)", "Cube (1)" is the parent of "Cube (2)"''<br>
+
''-- This Scripting Runtime is the component of the "Cube (2)" object.'' <br><br>
+
local obj = Space.Host.ExecutingObject;<br><br>
+
Space.Log(obj.Root.Name);<br>
+
''-- prints "Cube" to the console''}}
+
 
+
{{ScriptFunction|SGameObject[]|Children|{ get; }|Returns the list of direct children of this object.|5=
+
''-- For this example, 3 separate Game Objects ("Cube", "Cube (1)", "Cube (2)") are used.''<br>
+
''-- "Cube" is the parent of both "Cube (1)" and "Cube (2)" (in this order in the hierarchy).''<br>
+
''-- This Scripting Runtime is the component of the "Cube" object.'' <br><br>
+
local obj = Space.Host.ExecutingObject;<br><br>
+
Space.Log(obj.Children[1].Name);<br>
+
''-- prints "Cube (1)" to the console''<br>
+
Space.Log(obj.Children[2].Name);<br>
+
''-- prints "Cube (2)" to the console''<br>}}
+
 
+
 
+
 
+
{{ScriptFunction|SVector|WorldPosition|{ get; set; }|Gets or sets the current position of this object relative to the scene|5=<pre>Space.Host.ExecutingObject.WorldPosition = Vector.New(1,1,1)</pre>|6=<pre>
+
--the below script will make this object move to the right
+
--on click and then move back to the left clicked again
+
--(Example: sliding door open/close)
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
DoorIsOpen = false
+
 
+
 
+
OpenDoor = function()
+
thisGameObject.WorldPosition = thisGameObject.WorldPosition + thisGameObject.Right
+
DoorIsOpen = true
+
end
+
 
+
CloseDoor = function()
+
thisGameObject.WorldPosition = thisGameObject.WorldPosition - thisGameObject.Right
+
DoorIsOpen = false
+
end
+
 
+
 
+
OnClick = function()
+
    if DoorIsOpen then
+
      CloseDoor()
+
    else
+
      OpenDoor()
+
    end
+
end
+
 
+
thisGameObject.AddClickable()
+
thisGameObject.Clickable.Tooltip="Open/Close Sliding Door"
+
thisGameObject.Clickable.OnClick(OnClick) </pre>}}
+
 
+
{{ScriptFunction|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|5=<pre>Space.Host.ExecutingObject.LocalPosition = Vector.New(1,1,1)</pre>}}
+
 
+
{{ScriptFunction|SQuaternion|WorldRotation|{ get; set; }|Gets or sets the current rotation of this object relative to the scene|5=<pre>Space.Host.ExecutingObject.WorldRotation = Quaternion.Euler(0,180,0)</pre>|6= <pre>
+
--the below script will make this object rotate +90 degrees
+
--on click and then -90 degrees back once clicked again
+
--(Example: door open/close)
+
--[The center of the object should be at the hinge of the door]
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
DoorIsOpen = false
+
 
+
 
+
OpenDoor = function()
+
local currentY = thisGameObject.WorldRotation.EulerAngles.Y
+
local newY = currentY + 90
+
 
+
thisGameObject.WorldRotation = Quaternion.Euler(0,newY,0)
+
DoorIsOpen = true
+
end
+
 
+
CloseDoor = function()
+
local currentY = thisGameObject.WorldRotation.EulerAngles.Y
+
local newY = currentY - 90
+
 
+
thisGameObject.WorldRotation = Quaternion.Euler(0,newY,0)
+
DoorIsOpen = false
+
end
+
 
+
 
+
OnClick = function()
+
    if DoorIsOpen then
+
      CloseDoor()
+
    else
+
      OpenDoor()
+
    end
+
end
+
 
+
thisGameObject.AddClickable()
+
thisGameObject.Clickable.Tooltip="Open/Close Door"
+
thisGameObject.Clickable.OnClick(OnClick)
+
</pre>}}
+
 
+
{{ScriptFunction|SQuaternion|LocalRotation|{ get; set; }|Gets or sets the current rotation of this object relative to the parent object|5=<pre>Space.Host.ExecutingObject.LocalRotation = Quaternion.Euler(0,180,0)</pre>|6= <pre> --the below script will make this child object rotate
+
--while the parent object stays fixed
+
--(Example: A staff which has a rotating orb on top)
+
--[This object needs to be a child of an object for LocalRotation to be applicable]
+
--<Note: We multiplied by Space.DeltaTime to achieve movement per second not per frame>
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
SPEED = 2
+
 
+
 
+
OnUpdate = function()
+
currentY = thisGameObject.LocalRotation.EulerAngles.Y
+
newY = currentY + ( 1 * Space.DeltaTime * SPEED)
+
thisGameObject.LocalRotation = Quaternion.Euler(0, newY, 0)
+
end
+
 
+
 
+
thisGameObject.SubscribeToEvents()
+
thisGameObject.OnUpdate(OnUpdate) </pre>}}
+
 
+
{{ScriptFunction|SVector|LocalScale|{ get; set; }|Gets or sets the current scale of this object relative to the parent|5=<pre>Space.Host.ExecutingObject.LocalScale = Vector.New(2,2,2)</pre>}}
+
 
+
{{ScriptFunction|SVector|WorldScale|{ get; }|Gets the current scale of this object relative to the scene|5=<pre>worldScale = Space.Host.ExecutingObject.WorldScale </pre>}}
+
 
+
{{ScriptFunction|SVector|Forward|{ get; }|Returns the forward direction vector of this game object (blue arrow)|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
obj.WorldRotation = Quaternion.Euler(0,0,0);<br>
+
Space.Log(obj.Forward);<br>
+
''-- prints "[0,0,1]" to the console''<br>
+
obj.WorldRotation = Quaternion.Euler(0,90,0);<br>
+
Space.Log(obj.Forward);<br>
+
''-- prints "[1,0,0]" to the console - now it points in the direction the Right directional vector was pointing in.''|6=<pre>--the below script will make this object keep moving Forward (the rotation it is facing)
+
--(Example: Shooting a bullet to your front)
+
--<Note: We multiplied .Forward by Space.DeltaTime to achieve movement per second not per frame>
+
--<Note: If you want to go backwards you can just minus from the WorldPosition instead of add>
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
SPEED = 2
+
 
+
OnUpdate = function()
+
thisGameObject.WorldPosition = thisGameObject.WorldPosition + (thisGameObject.Forward * Space.DeltaTime * SPEED)
+
end
+
 
+
thisGameObject.SubscribeToEvents()
+
thisGameObject.OnUpdate(OnUpdate)</pre>}}
+
 
+
 
+
{{ScriptFunction|SVector|Up|{ get; }|Returns the up direction vector of this game object (green arrow)|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
obj.WorldRotation = Quaternion.Euler(0,0,0);<br>
+
Space.Log(obj.Up);<br>
+
''-- prints "[0,1,0]" to the console''<br>
+
obj.WorldRotation = Quaternion.Euler(90,0,0);<br>
+
Space.Log(obj.Up);<br>
+
''-- prints "[0,0,1]" to the console - now it points in the direction the Forward directional vector was pointing in.''|6= <pre>
+
--the below script will make this object keep moving to it's Right
+
--(Example: A rocket travelling upwards)
+
--<Note: We multiplied .Up by Space.DeltaTime to achieve movement per second not per frame>
+
--<Note: If you want to go down you can just minus from the WorldPosition instead of add>
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
SPEED = 1
+
 
+
OnUpdate = function()
+
thisGameObject.WorldPosition = thisGameObject.WorldPosition + (thisGameObject.Up * Space.DeltaTime * SPEED)
+
end
+
 
+
thisGameObject.SubscribeToEvents()
+
thisGameObject.OnUpdate(OnUpdate) </pre>}}
+
 
+
 
+
{{ScriptFunction|SVector|Right|{ get; }|Returns the right direction vector of this game object (red arrow)|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
obj.WorldRotation = Quaternion.Euler(0,0,0);<br>
+
Space.Log(obj.Right);<br>
+
''-- prints "[1,0,0]" to the console''<br>
+
obj.WorldRotation = Quaternion.Euler(0,0,90);<br>
+
Space.Log(obj.Right);<br>
+
''-- prints "[0,1,0]" to the console - now it points in the direction the Up directional vector was pointing in.''|6=<pre>--the below script will make this object keep moving to it's Right
+
--(Example: Shooting a bullet to your right)
+
--<Note: We multiplied .Right by Space.DeltaTime to achieve movement per second not per frame>
+
--<Note: If you want to go left you can just minus from the WorldPosition instead of add>
+
 
+
thisGameObject = Space.Host.ExecutingObject
+
SPEED = 1
+
 
+
OnUpdate = function()
+
thisGameObject.WorldPosition = thisGameObject.WorldPosition + (thisGameObject.Right * Space.DeltaTime * SPEED)
+
end
+
 
+
thisGameObject.SubscribeToEvents()
+
thisGameObject.OnUpdate(OnUpdate)</pre>}}
+
 
+
 
+
{{ScriptFunction|SLight|Light|{ get; }|Returns a reference to a Light component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Light component to the object if there is none''<br>
+
if obj.Light == null then<br>
+
:obj.AddLight ();<br>
+
end<br><br>
+
''-- Now we can work with the Light component on this object.''<br>
+
''-- For example, let's set its colour to Red:''<br>
+
obj.Light.Color = Vector.New(1,0,0);}}
+
 
+
 
+
{{ScriptFunction|SAnimator|Animator|{ get; }|Returns a reference to a Animator component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
Space.Log(obj.Animator);<br>
+
''-- prints "SAnimator" to the console if there is an Animator component on this object, or an empty string, if there is none.''}}
+
 
+
{{ScriptFunction|SAudioSource|Audio|{ get; }|Returns a reference to a AudioSource component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the AudioSource component to the object if there is none''<br>
+
if obj.Audio == null then<br>
+
:obj.AddAudioSource();<br>
+
end<br><br>
+
Space.Log(obj.Audio);<br>
+
''-- Now we can work with the AudioSource component on this object.''<br>
+
''-- For example, let's set its volume to 0.25:''<br>
+
obj.Audio.Volume = 0.25;}}
+
 
+
 
+
{{ScriptFunction|SBrowserSurface|Browser|{ get; }|Returns a reference to a BrowserSurface component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- If this object has a BrowserSurface component, the script will reload the page in it''<br>
+
if obj.Browser ~= null then<br>
+
:obj.Browser.Reload ();<br>
+
end}}
+
 
+
 
+
{{ScriptFunction|SRenderer|Renderer|{ get; }|Returns a reference to a Renderer component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- If this object has a Renderer component, let's colour its material blue!''<br>
+
if obj.Renderer ~= null then<br>
+
:obj.Renderer.Material.SetColor("_Color", 0, 0, 1, 1);<br>
+
end}}
+
 
+
 
+
{{ScriptFunction|SClickable|Clickable|{ get; }|Returns a reference to a Clickable component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Clickable component to the object if there is none''<br>
+
if obj.Clickable == null then<br>
+
:obj.AddClickable();<br>
+
end<br><br>
+
Space.Log(obj.Clickable);<br>
+
''--Now we can work with the Clickable component on this object.''<br>
+
''-- Let's add an option for the object to be moved up by 1 every time that option is chosen:''<br>
+
local deltaPos = Vector.New(0,1,0);<br><br>
+
function MoveItUp ()
+
:obj.WorldPosition = obj.WorldPosition + deltaPos;<br>
+
end<br>
+
obj.Clickable.AddExtraAction ("Move up", "Moves the object up by 1.", MoveItUp);}}
+
 
+
{{ScriptFunction|SRigidbody|Rigidbody|{ get; }|Returns a reference to a Rigidbody component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Rigidbody component to the object if there is none''<br>
+
if obj.Rigidbody == null then<br>
+
:obj.AddRigidbody();<br>
+
end<br><br>
+
Space.Log(obj.Rigidbody);<br>
+
''-- Now we can work with the Rigidbody component on this object.''<br>
+
''-- Let's make it spin!''<br>
+
obj.Rigidbody.UseGravity = false;<br>
+
obj.Rigidbody.AngularDrag = 0;<br>
+
obj.Rigidbody.AngularVelocity = Vector.New(0,Space.Math.Pi/2,0);}}
+
 
+
 
+
{{ScriptFunction|SCollider|Collider|{ get; }|Returns a reference to a Collider component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br>
+
''-- If this object has a Collider component, let's make it a trigger:''<br>
+
if obj.Collider ~= null then
+
:obj.Collider.IsTrigger = true;
+
end}}
+
 
+
{{ScriptFunction|SUIText|UIText|{ get; }|Returns a reference to a UI.Text component on the object. Will return null if it does not exist.|5=<pre>uitext = Space.Host.ExecutingObject.UIText </pre>}}
+
 
+
 
+
{{ScriptFunction|SNavMeshAgent|NavMeshAgent|{ get; }|Returns a reference to a NavMeshAgent component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the NavMeshAgent component to the object if there is none''<br>
+
if obj.NavMeshAgent == null then<br>
+
:obj.AddNavMeshAgent();<br>
+
end<br><br>
+
Space.Log(obj.NavMeshAgent);<br>
+
''-- prints "SNavMeshAgent" to the console. Now we can work with the NavMeshAgent component on this object.''}}
+
 
+
 
+
{{ScriptFunction|SSeat|Seat|{ get; }|Returns a reference to a Seat component on the object. Will return null if it does not exist.|5=
+
local obj = Space.Host.ExecutingObject;<br><br>
+
''-- add the Seat component to the object if there is none''<br>
+
if obj.Seat == null then<br>
+
:obj.AddSeat();<br>
+
end<br><br>
+
Space.Log(obj.Seat);<br>
+
''-- prints "SSeat" to the console. Now we can work with the Seat component on this object.''}}
+
 
+
{{ScriptFunction|long|Owner|{ get; }|Returns the GameObject's Owner|5= <pre>Owner = Space.Host.ExecutingObject.Owner</pre>}}
+
 
+
{{ScriptFunction|int|LocalID|{ get; }|Returns the GameObject's Local ID|5= <pre>LocalID = Space.Host.ExecutingObject.LocalID</pre>}}
+
 
+
{{ScriptFunction|int|InventoryID|{ get; }|Return's the GameObject's InventoryID|5= <pre>InventoryID = Space.Host.ExecutingObject.InventoryID</pre>}}
+
 
+
{{ScriptFunction|bool|HasStableID|{ get; }|Returns true if GameObject has Stable ID|5= <pre>HasStableID = Space.Host.ExecutingObject.HasStableID</pre>}}
+
 
+
{{ScriptFunction|string|GlobalID|{ get; }|Returns the global ID of the GameObject|5= <pre>GlobalID = Space.Host.ExecutingObject.GlobalID</pre>}}
+
 
+
{{ScriptFunction|SHingeJoint|HingeJoint|{ get; }|Returns a HingeJoint component attached to this object, or nil if none exist|5= <pre>HingeJoint = Space.Host.ExecutingObject.HingeJoint</pre>}}
+
 
+
{{ScriptFunction|SLight|Light|{ get; }|Returns a Light component attached to this object, or nil if none exist|5= <pre>Light = Space.Host.ExecutingObject.Light</pre>}}
+
 
+
{{ScriptFunction|SReflectionProbe|ReflectionProbe|{ get; }|Returns a ReflectionProbe component attached to this object, or nil if none exist|5= <pre>ReflectionProbe = Space.Host.ExecutingObject.ReflectionProbe</pre>}}
+
 
+
{{ScriptFunction|SLight|LightInChild|{ get; }|Returns a Light component attached to this object or its children, or nil if none exist|5= <pre>LightInChild = Space.Host.ExecutingObject.LightInChild</pre>}}
+
 
+
{{ScriptFunction|SLight|LightInParent|{ get; }|Returns a Light component attached to this object or it's parent, or nil if none exist|5= <pre>LightInParent = Space.Host.ExecutingObject.LightInParent</pre>}}
+
 
+
{{ScriptFunction|SRoomFloor|Floor|{ get; }|Returns a RoomFloor component attached to this object, or nil if none exist|5= <pre>Floor = Space.Host.ExecutingObject.Floor</pre>}}
+
 
+
{{ScriptFunction|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|5= <pre>Animation = Space.Host.ExecutingObject.Animation</pre>}}
+
 
+
{{ScriptFunction|SCanvasGroup|CanvasGroup|{ get; }|Returns  Canvas Group component attached to this object, or nil if none exist|5= <pre>CanvasGroup = Space.Host.ExecutingObject.CanvasGroup</pre>}}
+
 
+
{{ScriptFunction|SVoiceZone|VoiceZone|{ get; }|Returns a VoiceZone component attached to this object, or nil if none exist|5= <pre>VoiceZone = Space.Host.ExecutingObject.VoiceZone</pre>}}
+
 
+
{{ScriptFunction|SPlayableDirector|Director|{ get; }|Returns a PlayableDirector component attached to this object, or nil if none exist|5= <pre>Director = Space.Host.ExecutingObject.Director</pre>}}
+
 
+
{{ScriptFunction|SModularVehicle|Vehicle|{ get; }|Returns a Modular Vehicle component attached to this object, or nil if none exist |5= <pre>Vehicle = Space.Host.ExecutingObject.Vehicle</pre>}}
+
 
+
{{ScriptFunction|SPostProcessVolume|PostProcessVolume|{ get; }|Returns a Post Process Volume component attached to this object, or nil if none exist|5= <pre>PostProcessVolume = Space.Host.ExecutingObject.PostProcessVolume</pre>}}
+
 
+
{{ScriptFunction|SAXModel|Archimatix|{ get; }|Returns a Archimatix Model ("AXModel" component) - or Nil if nothing exists|5= <pre>Archimatix = Space.Host.ExecutingObject.Archimatix</pre>}}
+
 
+
{{ScriptFunction|SEmbeddedVideo|EmbeddedVideo|{ get; }|Returns an Embedded Video component attached to this object, or nil if none exist (may not work within editor)|5= <pre>EmbeddedVideo = Space.Host.ExecutingObject.EmbeddedVideo</pre>}}
+
 
+
{{ScriptFunction|SAvatar|Avatar|{ get; }|Return's GameObject's Avatar|5= <pre>Avatar = Space.Host.ExecutingObject.Avatar</pre>}}
+
 
+
{{ScriptFunction|SAvatarAppearance|AvatarAppearance|{ get; }|Returns a AvatarAppearance component attached to this object, or nil if none exist|5= <pre>AvatarAppearance = Space.Host.ExecutingObject.AvatarAppearance</pre>}}
+
 
+
{{ScriptFunction|SScriptingRuntime|Script|{ get; }|Returns a Scripting Runtime component attached to this object, or nil if none exist |5= <pre>Script = Space.Host.ExecutingObject.Script</pre>}}
+
 
+
{{ScriptFunction|long|StateMachine|{ get; }|Returns a State Machine component attached to this object, or nil if none exist |5= <pre>StateMachine = Space.Host.ExecutingObject.StateMachine</pre>}}
+
 
+
{{ScriptFunction|SScriptingEvents|Events|{ get; }|Returns a Scripting Events component attached to this object, or nil if none exist |5= <pre>Events = Space.Host.ExecutingObject.Events</pre>}}
+
 
+
{{ScriptFunction|SScriptingData|Data|{ get; }|Returns a Scripting Data component attached to this object, or nil if none exist|5= <pre>Data = Space.Host.ExecutingObject.Data</pre>}}
+
 
+
{{ScriptFunction|SBoxCollider|BoxCollider|{ get; }|Returns a Box Collider component attached to this object, or nil if none exist|5= <pre>BoxCollider = Space.Host.ExecutingObject.BoxCollider</pre>}}
+
 
+
{{ScriptFunction|SSphereCollider|SphereCollider|{ get; }|Returns a Sphere Collider component attached to this object, or nil if none exist|5= <pre>SphereCollider = Space.Host.ExecutingObject.SphereCollider</pre>}}
+
 
+
{{ScriptFunction|SCapsuleCollider|CapsuleCollider|{ get; }|Returns a Capsule Collider component attached to this object, or nil if none exist|5= <pre>CapsuleCollider = Space.Host.ExecutingObject.CapsuleCollider</pre>}}
+
 
+
{{ScriptFunction|SCharacterController|CharacterController|{ get; }|Returns a Character Controller component attached to this object, or nil if none exist|5= <pre>CharacterController = Space.Host.ExecutingObject.CharacterController</pre>}}
+
 
+
{{ScriptFunction|SAudioReactiveBase|AudioReactive|{ get; }|Returns the first Audio Reactive component attached to this object, or nil if none exist|5= <pre>AudioReactive = Space.Host.ExecutingObject.AudioReactive</pre>}}
+
 
+
{{ScriptFunction|SAttachmentHelper|AttachmentHelper|{ get; }|Returns the first Attachment Helper component attached to this object, or nil if none exist |5= <pre>AttachmentHelper = Space.Host.ExecutingObject.AttachmentHelper</pre>}}
+
 
+
{{ScriptFunction|SAudioReactiveAnimation|AudioReactiveAnimation|{ get; }|Returns the first Audio Reactive Animation component attached to this object, or nil if none exist |5= <pre>AudioReactiveAnimation = Space.Host.ExecutingObject.AudioReactiveAnimation</pre>}}
+
 
+
{{ScriptFunction|SAudioReactiveLight|AudioReactiveLight|{ get; }|Returns the first Audio Reactive Light component attached to this object, or nil if none exist |5= <pre>AudioReactiveLight = Space.Host.ExecutingObject.AudioReactiveLight</pre>}}
+
 
+
{{ScriptFunction|SAudioReactiveParticleSystem|AudioReactiveParticleSystem|{ get; }|Returns the first Audio Reactive Particle System component attached to this object, or nil if none exist |5= <pre>AudioReactiveParticleSystem = Space.Host.ExecutingObject.AudioReactiveParticleSystem</pre>}}
+
 
+
{{ScriptFunction|SAudioReactiveMaterial|AudioReactiveMaterial|{ get; }|Returns the first Audio Reactive Material component attached to this object, or nil if none exist|5= <pre>AudioReactiveMaterial = Space.Host.ExecutingObject.AudioReactiveMaterial</pre>}}
+
 
+
{{ScriptFunction|SAudioReactiveTransform|AudioReactiveTransform|{ get; }|Returns the first Audio Reactive Transform component attached to this object, or nil if none exist |5= <pre>AudioReactiveTransform = Space.Host.ExecutingObject.AudioReactiveTransform</pre>}}
+
 
+
{{ScriptFunction|STrailRenderer|TrailRenderer|{ get; }|Returns a Unity component attached to this object, or nil if none exist|5= <pre>TrailRenderer = Space.Host.ExecutingObject.TrailRenderer</pre>}}
+
 
+
{{ScriptFunction|SLineRenderer|LineRenderer|{ get; }|Returns a Unity component attached to this object, or nil if none exist |5= <pre>LineRenderer = Space.Host.ExecutingObject.LineRenderer</pre>}}
+
 
+
{{ScriptFunction|SUILayout|UILayout|{ get; }|Returns a Renderer component attached to this object, or nil if none exist|5= <pre>UILayout = Space.Host.ExecutingObject.UILayout</pre>}}
+
 
+
{{ScriptFunction|SUIToggle|UIToggle|{ get; }|Returns a Unity uGUI Toggle component attached to this object, or nil if none exist |5= <pre>UIToggle = Space.Host.ExecutingObject.UIToggle</pre>}}
+
 
+
{{ScriptFunction|SUIDropdown|UIDropdown|{ get; }|Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist |5= <pre>UIDropdown = Space.Host.ExecutingObject.UIDropdown</pre>}}
+
 
+
{{ScriptFunction|SUIButton|UIButton|{ get; }|Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist |5= <pre>UIButton = Space.Host.ExecutingObject.UIButton</pre>}}
+
 
+
{{ScriptFunction|SUISlider|UISlider|{ get; }|Returns a Unity uGUI Slider component attached to this object, or nil if none exist|5= <pre>UISlider = Space.Host.ExecutingObject.UISlider</pre>}}
+
 
+
{{ScriptFunction|SUIScrollbar|UIScrollbar|{ get; }|Returns a Unity uGUI Scrollbar component attached to this object, or nil if none exist|5= <pre>UIScrollbar = Space.Host.ExecutingObject.UIScrollbar</pre>}}
+
 
+
{{ScriptFunction|SUICanvas|UICanvas|{ get; }|Returns a Unity uGUI Canvas component attached to this object, or nil if none exist|5= <pre>UICanvas = Space.Host.ExecutingObject.UICanvas</pre>}}
+
 
+
{{ScriptFunction|SUIImage|UIImage|{ get; }|Returns a Unity uGUI Image component attached to this object, or nil if none exist|5= <pre>UIImage = Space.Host.ExecutingObject.UIImage</pre>}}
+
 
+
{{ScriptFunction|SUIRawImage|UIRawImage|{ get; }|Returns a Unity uGUI Text component attached to this object, or nil if none exist|5= <pre>UIRawImage = Space.Host.ExecutingObject.UIRawImage</pre>}}
+
 
+
{{ScriptFunction|SUIInputField|UIInputField|{ get; }|Returns a Unity uGUI Text component attached to this object, or nil if none exist|5= <pre>UIInputField = Space.Host.ExecutingObject.UIInputField</pre>}}
+
 
+
{{ScriptFunction|SVirtualCamera|VirtualCamera|{ get; }|Returns a VirtualCamera component attached to this object, or nil if none exists|5= <pre>VirtualCamera = Space.Host.ExecutingObject.VirtualCamera</pre>}}
+
 
+
{{ScriptFunction|SCloth|Cloth|{ get; }|Returns a Cloth component attached to this object, or nil if none exists|5= <pre>Cloth = Space.Host.ExecutingObject.Cloth</pre>}}
+
 
+
{{ScriptFunction|SMeshRenderer|MeshRenderer|{ get; }|Returns a MeshRenderer component attached to this object, or nil if none exists|5= <pre>MeshRenderer = Space.Host.ExecutingObject.MeshRenderer</pre>}}
+
 
+
{{ScriptFunction|SFurniture|Furniture|{ get; }|Returns a Furniture component attached to this object, or nil if none exists|5= <pre>Furniture = Space.Host.ExecutingObject.Furniture</pre>}}
+
 
+
{{ScriptFunction|SParticleSystem|ParticleSystem|{ get; }|Returns a ParticleSystem component attached to this object, or nil if none exists|5= <pre>ParticleSystem = Space.Host.ExecutingObject.ParticleSystem</pre>}}
+
 
+
{{ScriptFunction|SNavMeshObstacle|NavMeshObstacle|{ get; }|Returns a NavMeshObstacle component attached to this object, or nil if none exists|5= <pre>NavMeshObstacle = Space.Host.ExecutingObject.NavMeshObstacle</pre>}}
+
 
+
{{ScriptFunction|SNetworking|Networking|{ get; }|Returns a Simple Networking component attached to this object, or nil if none exists|5= <pre>SimpleNetworking = Space.Host.ExecutingObject.Networking</pre>}}
+
 
+
{{ScriptFunction|SRectTransform|RectTransform|{ get; }|Returns a RectTransform component attached to this object, or nil if none exists|5= <pre>RectTransform = Space.Host.ExecutingObject.RectTransform</pre>}}
+
 
+
{{ScriptFunction|SSkinnedMeshRenderer|SkinnedMeshRenderer|{ get; }|Returns a SkinnedMeshRenderer component attached to this object, or nil if none exists|5= <pre>SkinnedMeshRenderer = Space.Host.ExecutingObject.SkinnedMeshRenderer</pre>}}
+
 
+
{{ScriptFunction|SSceneBackgroundMusic|Radio|{ get; }|Returns a SceneBackgroundMusic component attached to this object, or nil if none exists|5= <pre>Radio = Space.Host.ExecutingObject.Radio</pre>}}
+
 
+
{{ScriptFunction|STerrain|Terrain|{ get; }|Returns a Terrain component attached to this object, or nil if none exists|5= <pre>Terrain = Space.Host.ExecutingObject.Terrain</pre>}}
+
 
+
{{ScriptFunction|bool|Alive|{ get; }|Returns true if GameObject is Alive|5= <pre>Alive = Space.Host.ExecutingObject.Alive</pre>}}
+
 
+
{{ScriptFunction|bool|ActiveSelf|{ get;set; }|Returns true if GameObject is Active (even if it's parent is not active)|5= <pre>ActiveSelf = Space.Host.ExecutingObject.ActiveSelf</pre>}}
+
 
+
{{ScriptFunction|SEventCalendar|EventCalendar|{ get; }|Returns an EventCalendar component attached to this object, or nil if none exists||5= <pre>EventCalendar = Space.Host.ExecutingObject.EventCalendar</pre>}}
+
 
+
 
+
{{Scripting Navbox}}
+

Latest revision as of 07:54, 19 September 2022

This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/sgameobject