Breakroom is now Sinewave Campus. Book a meeting

SGameObject

ClientTypes
Dans cette classeSubscribeToEvents
  1. Fonctions
  2. SubscribeToEvents
  3. SetSiblingIndex
  4. SetAsFirstSibling
  5. SetAsLastSibling
  6. Duplicate
  7. Instantiate
  8. AddHingeJoint
  9. AddLight
  10. AddAnimator
  11. AddAudioSource
  12. AddClickable
  13. GetScript
  14. GetScriptsInChildren
  15. GetScriptInChildren
  16. GetScriptInParent
  17. GetEvents
  18. GetAllEventsInChildren
  19. GetEventsInChildren
  20. GetEventsInParent
  21. GetResources
  22. GetAllResourcesInChildren
  23. GetResourcesInChildren
  24. GetResourcesInParent
  25. GetData
  26. GetAllDataInChildren
  27. GetDataInChildren
  28. GetDataInParent
  29. AddRigidbody
  30. AddNavMeshAgent
  31. AddSeat
  32. OnAwake
  33. OnStart
  34. OnEnable
  35. OnDisable
  36. OnFixedUpdate
  37. OnLateUpdate
  38. OnTriggerStart
  39. OnTriggerStay
  40. OnTriggerExit
  41. OnCollisionEnter
  42. OnCollisionStay
  43. OnCollisionExit
  44. OnParticleCollision
  45. OnParticleTrigger
  46. OnUpdate
  47. OnMouseDown
  48. OnApplicationQuit
  49. CompareTag
  50. SetParent
  51. Find
  52. FindInChildren
  53. Destroy
  54. GetComponent
  55. Propriétés
  56. Owner
  57. LocalID
  58. InventoryID
  59. HasStableID
  60. GlobalID
  61. Exists
  62. HingeJoint
  63. Light
  64. ReflectionProbe
  65. LightInChild
  66. LightInParent
  67. Animator
  68. Animation
  69. CanvasGroup
  70. Audio
  71. Floor
  72. VoiceZone
  73. Browser
  74. Director
  75. Renderer
  76. Vehicle
  77. PostProcessVolume
  78. Archimatix
  79. Clickable
  80. EmbeddedVideo
  81. Avatar
  82. AvatarAppearance
  83. Script
  84. StateMachine
  85. Networking
  86. Events
  87. Resources
  88. Data
  89. Rigidbody
  90. Collider
  91. BoxCollider
  92. SphereCollider
  93. CapsuleCollider
  94. WheelCollider
  95. CharacterController
  96. AudioReactive
  97. AttachmentHelper
  98. AudioReactiveAnimation
  99. AudioReactiveLight
  100. AudioReactiveParticleSystem
  101. AudioReactiveMaterial
  102. AudioReactiveTransform
  103. TrailRenderer
  104. LineRenderer
  105. UILayout
  106. UIToggle
  107. UIDropdown
  108. UIButton
  109. UIText
  110. UISlider
  111. UIScrollbar
  112. UICanvas
  113. UIImage
  114. UIRawImage
  115. UIInputField
  116. UIToolTipHint
  117. Camera
  118. VirtualCamera
  119. Cloth
  120. MeshRenderer
  121. Furniture
  122. NavMeshAgent
  123. NavMeshObstacle
  124. ParticleSystem
  125. RectTransform
  126. Seat
  127. SkinnedMeshRenderer
  128. Radio
  129. Terrain
  130. AnalyticsEvent
  131. GraphicRaycaster
  132. ContentSizeFitter
  133. Active
  134. ActiveSelf
  135. Layer
  136. Tag
  137. Name
  138. Moniker
  139. Parent
  140. Root
  141. Children
  142. WorldPosition
  143. LocalPosition
  144. WorldRotation
  145. LocalRotation
  146. LocalScale
  147. WorldScale
  148. Forward
  149. Up
  150. Right
  151. EventCalendar
Membres 149
FonctionSubscribeToEventsCauses this script to start listening to events on the object.
FonctionSetSiblingIndexSets the sibling index.
FonctionSetAsFirstSiblingThis GameObject becomes the first Sibling
FonctionSetAsLastSiblingThis GameObject becomes the last Sibling
FonctionDuplicateCopies the object and returns a reference to the copy.
FonctionInstantiateCopy of Duplicate() for convenience
FonctionAddHingeJointAdds a Hinge Joint component to this Game Object and returns its reference
FonctionAddLightAdds a Light component to the object.
FonctionAddAnimatorAdds an Animator component to this Game Object and returns its reference
FonctionAddAudioSourceAdds an AudioSource component to the object.
FonctionAddClickableAdds a Clickable component to the object.
FonctionGetScriptReturns a Scripting Runtime component attached to this object by Component Name, or nil if none exist
FonctionGetScriptsInChildrenReturns Scripting Runtime components attached to this object by Component Name or its children
FonctionGetScriptInChildrenReturns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist
FonctionGetScriptInParentReturns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist
FonctionGetEvents–
FonctionGetAllEventsInChildren–
FonctionGetEventsInChildren–
FonctionGetEventsInParent–
FonctionGetResources–
FonctionGetAllResourcesInChildren–
FonctionGetResourcesInChildren–
FonctionGetResourcesInParent–
FonctionGetDataReturns a Scripting Data component attached to this object by Component Name, or nil if none exist
FonctionGetAllDataInChildrenReturns Scripting Data components attached to this object by Component Name or its children
FonctionGetDataInChildrenReturns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist
FonctionGetDataInParentReturns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist
FonctionAddRigidbodyAdds a Rigidbody component to the object.
FonctionAddNavMeshAgentAdds a NavMeshAgent component to the object.
FonctionAddSeatAdds a Seat component to the object.
FonctionOnAwakeBinds a event to the Awake() event.
FonctionOnStartBinds a event to the Start() event.
FonctionOnEnableBinds a event to the OnEnable() event.
FonctionOnDisableBinds a event to the OnDisable() event.
FonctionOnFixedUpdateBinds a event to the OnFixedUpdate() event.
FonctionOnLateUpdateBinds a event to the OnLateUpdate() event.
FonctionOnTriggerStartWhen a GameObject collides with another GameObject, Unity calls OnTriggerEnter.
FonctionOnTriggerStayOnTriggerStay is called almost all the frames for every Collider other that is touching the trigger.
FonctionOnTriggerExitOnTriggerExit is called when the Collider other has stopped touching the trigger.
FonctionOnCollisionEnterOnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
FonctionOnCollisionStayOnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
FonctionOnCollisionExitOnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
FonctionOnParticleCollisionOnParticleCollision is called when a particle hits a Collider.
FonctionOnParticleTriggerBinds a new event handler for the OnParticleTrigger event.
FonctionOnUpdateBinds a event to the OnUpdate() event.
FonctionOnMouseDownBinds a event to the OnMouseDown() event.
FonctionOnApplicationQuitBinds a new event handler for the On Application Quit event
FonctionCompareTag–
FonctionSetParentMake this GameObject the child of GameObject 'other'
FonctionFindFind and return a reference to GameObject with name 'name'
FonctionFindInChildrenFind and return a reference to GameObject with name 'name' including children
FonctionDestroySchedules this object for deletion at the end of the frame
FonctionGetComponent–
PropriétéOwnerReturns the GameObject's Owner
PropriétéLocalIDReturns the GameObject's Local ID
PropriétéInventoryIDReturn's the GameObject's InventoryID
PropriétéHasStableIDReturns true if GameObject has Stable ID
PropriétéGlobalIDReturns the global ID of the GameObject
PropriétéExistsDoes this object still exist in the scene (returns false if the object has been deleted via Destroy();)
PropriétéHingeJointReturns a HingeJoint component attached to this object, or nil if none exist
PropriétéLightReturns a reference to a Light component on the object.
PropriétéReflectionProbeReturns a ReflectionProbe component attached to this object, or nil if none exist
PropriétéLightInChildReturns a Light component attached to this object or its children, or nil if none exist
PropriétéLightInParentReturns a Light component attached to this object or it's parent, or nil if none exist
PropriétéAnimatorReturns a reference to a Animator component on the object.
PropriétéAnimationReturns an Animation component attached to this object, or nil if none exist Animation is a legacy component and should not be confused with Animator
PropriétéCanvasGroupReturns Canvas Group component attached to this object, or nil if none exist
PropriétéAudioReturns a reference to a AudioSource component on the object.
PropriétéFloorReturns a RoomFloor component attached to this object, or nil if none exist
PropriétéVoiceZoneReturns a VoiceZone component attached to this object, or nil if none exist
PropriétéBrowserReturns a reference to a BrowserSurface component on the object.
PropriétéDirectorReturns a PlayableDirector component attached to this object, or nil if none exist
PropriétéRendererReturns a reference to a Renderer component on the object.
PropriétéVehicleReturns a Modular Vehicle component attached to this object, or nil if none exist
PropriétéPostProcessVolumeReturns a Post Process Volume component attached to this object, or nil if none exist
PropriétéArchimatixReturns a Archimatix Model ("AXModel" component) - or Nil if nothing exists
PropriétéClickableReturns a reference to a Clickable component on the object.
PropriétéEmbeddedVideoReturns an Embedded Video component attached to this object, or nil if none exist (may not work within editor)
PropriétéAvatarA reference to an Avatar component on the GameObject.
PropriétéAvatarAppearanceReturns a AvatarAppearance component attached to this object, or nil if none exist
PropriétéScriptReturns a Scripting Runtime component attached to this object, or nil if none exist
PropriétéStateMachineReturns a State Machine component attached to this object, or nil if none exist
PropriétéNetworkingReturns a Simple Networking component attached to this object, or nil if none exists
PropriétéEvents–
PropriétéResources–
PropriétéDataReturns a Scripting Data component attached to this object, or nil if none exist
PropriétéRigidbodyReturns a reference to a Rigidbody component on the object.
PropriétéColliderReturns a reference to a Collider component on the object.
PropriétéBoxColliderReturns a Box Collider component attached to this object, or nil if none exist
PropriétéSphereColliderReturns a Sphere Collider component attached to this object, or nil if none exist
PropriétéCapsuleColliderReturns a Capsule Collider component attached to this object, or nil if none exist
PropriétéWheelColliderReturns a WheelCollider component attached to this object, or nil if none exist
PropriétéCharacterControllerReturns a Character Controller component attached to this object, or nil if none exist
PropriétéAudioReactiveReturns the first Audio Reactive component attached to this object, or nil if none exist
PropriétéAttachmentHelperReturns the first Attachment Helper component attached to this object, or nil if none exist
PropriétéAudioReactiveAnimationReturns the first Audio Reactive Animation component attached to this object, or nil if none exist
PropriétéAudioReactiveLightReturns the first Audio Reactive Light component attached to this object, or nil if none exist
PropriétéAudioReactiveParticleSystemReturns the first Audio Reactive Particle System component attached to this object, or nil if none exist
PropriétéAudioReactiveMaterialReturns the first Audio Reactive Material component attached to this object, or nil if none exist
PropriétéAudioReactiveTransformReturns the first Audio Reactive Transform component attached to this object, or nil if none exist
PropriétéTrailRendererReturns a Trail Renderer component attached to this object, or nil if none exist
PropriétéLineRendererReturns a Line Renderer component attached to this object, or nil if none exist
PropriétéUILayoutReturns a Renderer component attached to this object, or nil if none exist
PropriétéUIToggleReturns a Unity uGUI Toggle component attached to this object, or nil if none exist
PropriétéUIDropdownReturns a Unity uGUI Dropdown component attached to this object, or nil if none exist
PropriétéUIButtonReturns a Unity uGUI Dropdown component attached to this object, or nil if none exist
PropriétéUITextReturns a reference to a UI.Text component on the object.
PropriétéUISliderReturns a Unity uGUI Slider component attached to this object, or nil if none exist
PropriétéUIScrollbarReturns a Unity uGUI Scrollbar component attached to this object, or nil if none exist
PropriétéUICanvasReturns a Unity uGUI Canvas component attached to this object, or nil if none exist
PropriétéUIImageReturns a Unity uGUI Image component attached to this object, or nil if none exist
PropriétéUIRawImageReturns a Unity uGUI Text component attached to this object, or nil if none exist
PropriétéUIInputFieldReturns a Unity uGUI Text component attached to this object, or nil if none exist
PropriétéUIToolTipHint–
PropriétéCamera–
PropriétéVirtualCameraReturns a VirtualCamera component attached to this object, or nil if none exists
PropriétéClothReturns a Cloth component attached to this object, or nil if none exists
PropriétéMeshRendererReturns a MeshRenderer component attached to this object, or nil if none exists
PropriétéFurnitureReturns a Furniture component attached to this object, or nil if none exists
PropriétéNavMeshAgentAdds a NavMeshAgent component to the object.
PropriétéNavMeshObstacleReturns a NavMeshObstacle component attached to this object, or nil if none exists
PropriétéParticleSystemReturns a ParticleSystem component attached to this object, or nil if none exists
PropriétéRectTransformReturns a RectTransform component attached to this object, or nil if none exists
PropriétéSeatReturns a reference to a Seat component on the object.
PropriétéSkinnedMeshRendererReturns a SkinnedMeshRenderer component attached to this object, or nil if none exists
PropriétéRadioReturns a SceneBackgroundMusic component attached to this object, or nil if none exists
PropriétéTerrainReturns a Terrain component attached to this object, or nil if none exists
PropriétéAnalyticsEvent–
PropriétéGraphicRaycaster–
PropriétéContentSizeFitter–
PropriétéActiveIs this object Active in the scene
PropriétéActiveSelfReturns true if GameObject is Active (even if it's parent is not active)
PropriétéLayerGets/Sets the object onto a particular layer (0-31)
PropriétéTagGets this objects Tag
PropriétéNameGets/sets the name of this object
PropriétéMoniker–
PropriétéParentGets/sets the parent GameObject of this object.
PropriétéRootGets the root of this object group - may be this object.
PropriétéChildrenReturns the list of direct children of this object.
PropriétéWorldPositionGets or sets the current position of this object relative to the scene
PropriétéLocalPositionGets or sets the current position of this object relative to the objects parent, taking into account local position/scale/rotation
PropriétéWorldRotationGets or sets the current rotation of this object relative to the scene
PropriétéLocalRotationGets or sets the current rotation of this object relative to the parent object
PropriétéLocalScaleGets or sets the current scale of this object relative to the parent
PropriétéWorldScaleGets the current scale of this object relative to the scene
PropriétéForwardReturns the forward direction vector of this game object (blue arrow)
PropriétéUpReturns the up direction vector of this game object (green arrow)
PropriétéRightReturns the right direction vector of this game object (red arrow)
PropriétéEventCalendarReturns an EventCalendar component attached to this object, or nil if none exists

Fonctions​

SubscribeToEvents​

void SubscribeToEvents()

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

Valeurs de retour

void

Exemple

Lua
Space.Host.ExecutingObject.SubscribeToEvents()

SetSiblingIndex​

void SetSiblingIndex(int newIndex)

Sets the sibling index.

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

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

Paramètres

NomTypeValeur par défaut
newIndexint–

Valeurs de retour

void

Exemple

Lua
Space.Host.ExecutingObject.SetSiblingIndex(2)

SetAsFirstSibling​

void SetAsFirstSibling()

This GameObject becomes the first Sibling

Valeurs de retour

void

Exemple

Lua
Space.Host.ExecutingObject.SetAsFirstSibling()

SetAsLastSibling​

void SetAsLastSibling()

This GameObject becomes the last Sibling

Valeurs de retour

void

Exemple

Lua
Space.Host.ExecutingObject.SetAsLastSibling()

Duplicate​

SGameObject Duplicate()

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

Valeurs de retour

SGameObject

Exemple

Lua
local copy = Space.Host.ExecutingObject.Duplicate()
Lua
--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​

SGameObject Instantiate()

Copy of Duplicate() for convenience

Valeurs de retour

SGameObject

Exemple

Lua
NewGameObject = Space.Host.ExecutingObject.Instantiate()
Lua
--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​

SHingeJoint AddHingeJoint()

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

Valeurs de retour

SHingeJoint

Exemple

Lua
NewHingeJoint = Space.Host.ExecutingObject.AddHingeJoint()
Lua
--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​

SLight AddLight()

Adds a Light component to the object.

Valeurs de retour

SLight

Exemple

Lua
newLightComponent = Space.Host.ExecutingObject.AddLight()

AddAnimator​

SAnimator AddAnimator()

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

Valeurs de retour

SAnimator

Exemple

Lua
NewAnimator = Space.Host.ExecutingObject.AddAnimator()
Lua
--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​

SAudioSource AddAudioSource()

Adds an AudioSource component to the object.

Valeurs de retour

SAudioSource

Exemple

Lua
newAudioSourceComponent = Space.Host.ExecutingObject.AddAudioSource()

AddClickable​

SClickable AddClickable()

Adds a Clickable component to the object.

Valeurs de retour

SClickable

Exemple

Lua
newClikcableComponent = Space.Host.ExecutingObject.AddClickable()

GetScript​

SScriptingRuntime GetScript(string name)

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

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingRuntime

Exemple

Lua
scriptingRuntime = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")

GetScriptsInChildren​

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

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

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

List< SScriptingRuntime >

Exemple

Lua
tableScriptsInChildren = Space.Host.ExecutingObject.GetScriptsInChildren("scriptingruntimecomponentname",true)

GetScriptInChildren​

SScriptingRuntime GetScriptInChildren(string name, bool includeInactive = false)

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

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

SScriptingRuntime

Exemple

Lua
scriptingRuntimeInChildren = Space.Host.ExecutingObject.GetScriptInChildren("scriptingruntimecomponentname",true)

GetScriptInParent​

SScriptingRuntime GetScriptInParent(string name)

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

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingRuntime

Exemple

Lua
scriptingRuntimeInParent = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")

GetEvents​

SScriptingEvents GetEvents(string name)

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingEvents

Exemple

Lua
scriptingEvent = Space.Host.ExecutingObject.GetEvents('ScriptingEventsComponentName')

GetAllEventsInChildren​

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

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

List< SScriptingEvents >

Exemple

Lua
tableScriptingEvent = Space.Host.ExecutingObject.GetAllEventsInChildren

GetEventsInChildren​

SScriptingEvents GetEventsInChildren(string name, bool includeInactive = false)

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

SScriptingEvents

Exemple

Lua
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName')
--or
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName', true)

GetEventsInParent​

SScriptingEvents GetEventsInParent(string name)

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingEvents

Exemple

Lua
scriptingEvent = Space.Host.ExecutingObject.GetEventsInParent('ScriptingEventsComponentName')

GetResources​

SScriptingResources GetResources(string name)

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingResources

Exemple

Lua
Space.Host.ExecutingObject.GetResources('ResourcesComponentName')

GetAllResourcesInChildren​

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

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

List< SScriptingResources >

Exemple

Lua
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName', true)

GetResourcesInChildren​

SScriptingResources GetResourcesInChildren(string name, bool includeInactive = false)

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

SScriptingResources

Exemple

Lua
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName', true)

GetResourcesInParent​

SScriptingResources GetResourcesInParent(string name)

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingResources

Exemple

Lua
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInParent('ScriptingResourcesComponentName')

GetData​

SScriptingData GetData(string name)

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

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingData

Exemple

Lua
scriptingData = Space.Host.ExecutingObject.GetData("scriptingdatacomponentname")

GetAllDataInChildren​

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

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

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

List< SScriptingData >

Exemple

Lua
tableScriptingDataInChildren = Space.Host.ExecutingObject.GetAllDataInChildren("scriptingdatacomponentname",true)

GetDataInChildren​

SScriptingData GetDataInChildren(string name, bool includeInactive = false)

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

Paramètres

NomTypeValeur par défaut
namestring–
includeInactiveboolfalse

Valeurs de retour

SScriptingData

Exemple

Lua
scriptingDataInChildren = Space.Host.ExecutingObject.GetDataInChildren("scriptingdatacomponentname",true)

GetDataInParent​

SScriptingData GetDataInParent(string name)

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

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SScriptingData

Exemple

Lua
scriptingDataInParent = Space.Host.ExecutingObject.GetDataInParent("scriptingdatacomponentname")

AddRigidbody​

SRigidbody AddRigidbody()

Adds a Rigidbody component to the object.

Valeurs de retour

SRigidbody

Exemple

Lua
newRigibodyComponent = Space.Host.ExecutingObject.AddRigidbody()

AddNavMeshAgent​

SNavMeshAgent AddNavMeshAgent()

Adds a NavMeshAgent component to the object.

Valeurs de retour

SNavMeshAgent

Exemple

Lua
newNavMeshAgentComponent = Space.Host.ExecutingObject.AddNavMeshAgent()

AddSeat​

SSeat AddSeat()

Adds a Seat component to the object.

Valeurs de retour

SSeat

Exemple

Lua
newSeatComponent = Space.Host.ExecutingObject.AddSeat()

OnAwake​

void OnAwake(Closure e)

Binds a event to the Awake() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnAwake(F)

OnStart​

void OnStart(Closure e)

Binds a event to the Start() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnStart(F)

OnEnable​

void OnEnable(Closure e)

Binds a event to the OnEnable() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnEnable(F)

OnDisable​

void OnDisable(Closure e)

Binds a event to the OnDisable() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnDisable(F)

OnFixedUpdate​

void OnFixedUpdate(Closure e)

Binds a event to the OnFixedUpdate() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnFixedUpdate(F)
Lua
--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​

void OnLateUpdate(Closure e)

Binds a event to the OnLateUpdate() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnLateUpdate(F)
Lua
--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​

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

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

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

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

Paramètres

NomTypeValeur par défaut
eAction< SGameObject >–
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnTriggerStart = function(SGameObject)
Space.Log("Trigger Start")
end

this.OnTriggerStart (OnTriggerStart )
Lua
--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​

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

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

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

Paramètres

NomTypeValeur par défaut
eAction< SGameObject >–
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnTriggerStay = function(SGameObject)
Space.Log("Trigger Stay")
end

this.OnTriggerStay(OnTriggerStay)
Lua
--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​

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

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

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

Paramètres

NomTypeValeur par défaut
eAction< SGameObject >–
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnTriggerExit = function(SGameObject)
Space.Log("Trigger Stay")
end

this.OnTriggerExit(OnTriggerExit)
Lua
--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​

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

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

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

Paramètres

NomTypeValeur par défaut
eAction< SPhysicsHit >–
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnCollisionEnter = function(SPhysicsHit)
Space.Log("Collision Enter")
end

this.OnCollisionEnter(OnCollisionEnter)
Lua
--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​

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

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

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

Paramètres

NomTypeValeur par défaut
eAction< SPhysicsHit >–
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnCollisionStay = function(SPhysicsHit)
Space.Log("Collision Stay")
end

this.OnCollisionStay(OnCollisionStay)
Lua
--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​

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

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

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

Paramètres

NomTypeValeur par défaut
eAction< SPhysicsHit >–
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnCollisionExit = function(SPhysicsHit)
Space.Log("Collision Exit")
end

this.OnCollisionExit(OnCollisionExit)
Lua
--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​

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

OnParticleCollision is called when a particle hits a Collider.

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

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

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

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

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

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

Paramètres

NomTypeValeur par défaut
eAction< SGameObject >–
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnParticleCollision = function(GameObject)
Space.Log("Particle Collision")
end

this.OnParticleCollision(OnParticleCollision)

OnParticleTrigger​

void OnParticleTrigger(Closure e)

Binds a new event handler for the OnParticleTrigger event.

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

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

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnParticleTrigger = function(GameObject)
Space.Log("Particle Trigger Event")
end

this.OnParticleTrigger(OnParticleTrigger)

OnUpdate​

void OnUpdate(Closure e)

Binds a event to the OnUpdate() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnUpdate(F)
Lua
--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​

void OnMouseDown(Closure e)

Binds a event to the OnMouseDown() event.

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnMouseDown(F)

OnApplicationQuit​

void OnApplicationQuit(Closure e)

Binds a new event handler for the On Application Quit event

Paramètres

NomTypeValeur par défaut
eClosure–

Valeurs de retour

void

Exemple

Lua
this = Space.Host.ExecutingObject

OnApplicationQuit = function()
Space.Log("Application Quit")
end

this.OnApplicationQuit(OnApplicationQuit)

CompareTag​

bool CompareTag(string tag)

Paramètres

NomTypeValeur par défaut
tagstring–

Valeurs de retour

bool

Exemple

Lua
isSame = Space.Host.ExecutingObject.CompareTag('tagname')

SetParent​

void SetParent(SGameObject other, bool worldPositionStays = true)

Make this GameObject the child of GameObject 'other'

Paramètres

NomTypeValeur par défaut
otherSGameObject–
worldPositionStaysbooltrue

Valeurs de retour

void

Exemple

Lua
Space.Host.ExecutingObject.SetParent(otherObjectReference,true)
Lua
--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​

SGameObject Find(string name)

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

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SGameObject

Exemple

Lua
FoundObject = Space.Host.ExecutingObject.Find("GameObject Name")

FindInChildren​

SGameObject FindInChildren(string name)

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

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SGameObject

Exemple

Lua
FoundObjectInChildren = Space.Host.ExecutingObject.FindInChildren("GameObject Name")

Destroy​

void Destroy()

Schedules this object for deletion at the end of the frame

Valeurs de retour

void

Exemple

Lua
Space.Host.ExecutingObject.Destroy()

GetComponent​

SComponent GetComponent(string name)

Paramètres

NomTypeValeur par défaut
namestring–

Valeurs de retour

SComponent

Propriétés​

OwnerLecture seule​

long Owner {get; }

Returns the GameObject's Owner

Exemple

Lua
Owner = Space.Host.ExecutingObject.Owner

LocalIDLecture seule​

int LocalID {get; }

Returns the GameObject's Local ID

Exemple

Lua
LocalID = Space.Host.ExecutingObject.LocalID

InventoryIDLecture seule​

int InventoryID {get; }

Return's the GameObject's InventoryID

Exemple

Lua
InventoryID = Space.Host.ExecutingObject.InventoryID

HasStableIDLecture seule​

bool HasStableID {get; }

Returns true if GameObject has Stable ID

Exemple

Lua
HasStableID = Space.Host.ExecutingObject.HasStableID

GlobalIDLecture seule​

string? GlobalID {get; }

Returns the global ID of the GameObject

Exemple

Lua
GlobalID = Space.Host.ExecutingObject.GlobalID

ExistsLecture seule​

bool Exists {get; }

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

Exemple

Lua
doesExist = Space.Host.ExecutingObject.Exists

HingeJointLecture seule​

SHingeJoint HingeJoint {get; }

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

Exemple

Lua
HingeJoint = Space.Host.ExecutingObject.HingeJoint

LightLecture seule​

SLight Light {get; }

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

Exemple

Lua
newLightComponent = Space.Host.ExecutingObject.Light

ReflectionProbeLecture seule​

SReflectionProbe ReflectionProbe {get; }

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

Exemple

Lua
ReflectionProbe = Space.Host.ExecutingObject.ReflectionProbe

LightInChildLecture seule​

SLight LightInChild {get; }

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

Exemple

Lua
LightInChild = Space.Host.ExecutingObject.LightInChild

LightInParentLecture seule​

SLight LightInParent {get; }

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

Exemple

Lua
LightInParent = Space.Host.ExecutingObject.LightInParent

AnimatorLecture seule​

SAnimator Animator {get; }

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

Exemple

Lua
animatorComponent = Space.Host.ExecutingObject.Animator

AnimationLecture seule​

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

Exemple

Lua
Animation = Space.Host.ExecutingObject.Animation

CanvasGroupLecture seule​

SCanvasGroup CanvasGroup {get; }

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

Exemple

Lua
CanvasGroup = Space.Host.ExecutingObject.CanvasGroup

AudioLecture seule​

SAudioSource Audio {get; }

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

Exemple

Lua
newAudioComponent = Space.Host.ExecutingObject.Audio

FloorLecture seule​

SRoomFloor Floor {get; }

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

Exemple

Lua
Floor = Space.Host.ExecutingObject.Floor

VoiceZoneLecture seule​

SVoiceZone VoiceZone {get; }

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

Exemple

Lua
VoiceZone = Space.Host.ExecutingObject.VoiceZone

BrowserLecture seule​

SBrowserSurface Browser {get; }

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

Exemple

Lua
newBrowserComponent = Space.Host.ExecutingObject.Browser

DirectorLecture seule​

SPlayableDirector Director {get; }

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

Exemple

Lua
Director = Space.Host.ExecutingObject.Director

RendererLecture seule​

SRenderer Renderer {get; }

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

Exemple

Lua
renderer = Space.Host.ExecutingObject.Renderer

VehicleLecture seule​

SModularVehicle Vehicle {get; }

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

Exemple

Lua
Vehicle = Space.Host.ExecutingObject.Vehicle

PostProcessVolumeLecture seule​

SPostProcessVolume PostProcessVolume {get; }

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

Exemple

Lua
PostProcessVolume = Space.Host.ExecutingObject.PostProcessVolume

ArchimatixLecture seule​

SAXModel Archimatix {get; }

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

Exemple

Lua
Archimatix = Space.Host.ExecutingObject.Archimatix

ClickableLecture seule​

SClickable Clickable {get; }

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

Exemple

Lua
clickableComponent = Space.Host.ExecutingObject.Clickable

EmbeddedVideoLecture seule​

SEmbeddedVideo EmbeddedVideo {get; }

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

Exemple

Lua
EmbeddedVideo = Space.Host.ExecutingObject.EmbeddedVideo

AvatarLecture seule​

SAvatar Avatar {get; }

A reference to an Avatar component on the GameObject.

Exemple

Lua
Avatar = Space.Host.ExecutingObject.Avatar

AvatarAppearanceLecture seule​

SAvatarAppearance AvatarAppearance {get; }

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

Exemple

Lua
AvatarAppearance = Space.Host.ExecutingObject.AvatarAppearance

ScriptLecture seule​

SScriptingRuntime Script {get; }

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

Exemple

Lua
Script = Space.Host.ExecutingObject.Script

StateMachineLecture seule​

SStateMachine StateMachine {get; }

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

Exemple

Lua
StateMachine = Space.Host.ExecutingObject.StateMachine

NetworkingLecture seule​

SNetworking Networking {get; }

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

Exemple

Lua
SimpleNetworking = Space.Host.ExecutingObject.Networking

EventsLecture seule​

SScriptingEvents Events {get; }

Exemple

Lua
eventsComponent = Space.Host.ExecutingObject.Events

ResourcesLecture seule​

SScriptingResources Resources {get; }

Exemple

Lua
resourcesComponent = Space.Host.ExecutingObject.Resources

DataLecture seule​

SScriptingData Data {get; }

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

Exemple

Lua
Data = Space.Host.ExecutingObject.Data

RigidbodyLecture seule​

SRigidbody Rigidbody {get; }

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

Exemple

Lua
rigidbodyComponent = Space.Host.ExecutingObject.Rigidbody

ColliderLecture seule​

SCollider Collider {get; }

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

Exemple

Lua
colliderComponent = Space.Host.ExecutingObject.Collider

BoxColliderLecture seule​

SBoxCollider BoxCollider {get; }

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

Exemple

Lua
BoxCollider = Space.Host.ExecutingObject.BoxCollider

SphereColliderLecture seule​

SSphereCollider SphereCollider {get; }

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

Exemple

Lua
SphereCollider = Space.Host.ExecutingObject.SphereCollider

CapsuleColliderLecture seule​

SCapsuleCollider CapsuleCollider {get; }

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

Exemple

Lua
CapsuleCollider = Space.Host.ExecutingObject.CapsuleCollider

WheelColliderLecture seule​

SWheelCollider WheelCollider {get; }

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

Exemple

Lua
WheelCollider = Space.Host.ExecutingObject.WheelCollider

CharacterControllerLecture seule​

SCharacterController CharacterController {get; }

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

Exemple

Lua
CharacterController = Space.Host.ExecutingObject.CharacterController

AudioReactiveLecture seule​

SAudioReactiveBase AudioReactive {get; }

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

Exemple

Lua
AudioReactive = Space.Host.ExecutingObject.AudioReactive

AttachmentHelperLecture seule​

SAttachmentHelper AttachmentHelper {get; }

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

Exemple

Lua
AttachmentHelper = Space.Host.ExecutingObject.AttachmentHelper

AudioReactiveAnimationLecture seule​

SAudioReactiveAnimation AudioReactiveAnimation {get; }

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

Exemple

Lua
AudioReactiveAnimation = Space.Host.ExecutingObject.AudioReactiveAnimation

AudioReactiveLightLecture seule​

SAudioReactiveLight AudioReactiveLight {get; }

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

Exemple

Lua
AudioReactiveLight = Space.Host.ExecutingObject.AudioReactiveLight

AudioReactiveParticleSystemLecture seule​

SAudioReactiveParticleSystem AudioReactiveParticleSystem {get; }

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

Exemple

Lua
AudioReactiveParticleSystem = Space.Host.ExecutingObject.AudioReactiveParticleSystem

AudioReactiveMaterialLecture seule​

SAudioReactiveMaterial AudioReactiveMaterial {get; }

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

Exemple

Lua
AudioReactiveMaterial = Space.Host.ExecutingObject.AudioReactiveMaterial

AudioReactiveTransformLecture seule​

SAudioReactiveTransform AudioReactiveTransform {get; }

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

Exemple

Lua
AudioReactiveTransform = Space.Host.ExecutingObject.AudioReactiveTransform

TrailRendererLecture seule​

STrailRenderer TrailRenderer {get; }

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

Exemple

Lua
TrailRenderer = Space.Host.ExecutingObject.TrailRenderer

LineRendererLecture seule​

SLineRenderer LineRenderer {get; }

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

Exemple

Lua
LineRenderer = Space.Host.ExecutingObject.LineRenderer

UILayoutLecture seule​

SUILayout UILayout {get; }

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

Exemple

Lua
UILayout = Space.Host.ExecutingObject.UILayout

UIToggleLecture seule​

SUIToggle UIToggle {get; }

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

Exemple

Lua
UIToggle = Space.Host.ExecutingObject.UIToggle

UIDropdownLecture seule​

SUIDropdown UIDropdown {get; }

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

Exemple

Lua
UIDropdown = Space.Host.ExecutingObject.UIDropdown

UIButtonLecture seule​

SUIButton UIButton {get; }

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

Exemple

Lua
UIButton = Space.Host.ExecutingObject.UIButton

UITextLecture seule​

SUIText UIText {get; }

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

Exemple

Lua
uitext = Space.Host.ExecutingObject.UIText

UISliderLecture seule​

SUISlider UISlider {get; }

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

Exemple

Lua
UISlider = Space.Host.ExecutingObject.UISlider

UIScrollbarLecture seule​

SUIScrollbar UIScrollbar {get; }

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

Exemple

Lua
UIScrollbar = Space.Host.ExecutingObject.UIScrollbar

UICanvasLecture seule​

SUICanvas UICanvas {get; }

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

Exemple

Lua
UICanvas = Space.Host.ExecutingObject.UICanvas

UIImageLecture seule​

SUIImage UIImage {get; }

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

Exemple

Lua
UIImage = Space.Host.ExecutingObject.UIImage

UIRawImageLecture seule​

SUIRawImage UIRawImage {get; }

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

Exemple

Lua
UIRawImage = Space.Host.ExecutingObject.UIRawImage

UIInputFieldLecture seule​

SUIInputField UIInputField {get; }

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

Exemple

Lua
UIInputField = Space.Host.ExecutingObject.UIInputField

UIToolTipHintLecture seule​

SUIToolTipHint UIToolTipHint {get; }

Exemple

Lua
tooltipHint = Space.Host.ExecutingObject.UIToolTipHint

CameraLecture seule​

SCamera Camera {get; }

Exemple

Lua
camera = Space.Host.ExecutingObject.Camera

VirtualCameraLecture seule​

SVirtualCamera VirtualCamera {get; }

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

Exemple

Lua
VirtualCamera = Space.Host.ExecutingObject.VirtualCamera

ClothLecture seule​

SCloth Cloth {get; }

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

Exemple

Lua
Cloth = Space.Host.ExecutingObject.Cloth

MeshRendererLecture seule​

SMeshRenderer MeshRenderer {get; }

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

Exemple

Lua
MeshRenderer = Space.Host.ExecutingObject.MeshRenderer

FurnitureLecture seule​

SFurniture Furniture {get; }

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

Exemple

Lua
Furniture = Space.Host.ExecutingObject.Furniture
SNavMeshAgent NavMeshAgent {get; }

Adds a NavMeshAgent component to the object.

Exemple

Lua
navMeshAgent = Space.Host.ExecutingObject.AddNavMeshAgent()
SNavMeshObstacle NavMeshObstacle {get; }

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

Exemple

Lua
NavMeshObstacle = Space.Host.ExecutingObject.NavMeshObstacle

ParticleSystemLecture seule​

SParticleSystem ParticleSystem {get; }

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

Exemple

Lua
ParticleSystem = Space.Host.ExecutingObject.ParticleSystem

RectTransformLecture seule​

SRectTransform RectTransform {get; }

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

Exemple

Lua
RectTransform = Space.Host.ExecutingObject.RectTransform

SeatLecture seule​

SSeat Seat {get; }

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

Exemple

Lua
seatComponent = Space.Host.ExecutingObject.AddSeat()

SkinnedMeshRendererLecture seule​

SSkinnedMeshRenderer SkinnedMeshRenderer {get; }

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

Exemple

Lua
SkinnedMeshRenderer = Space.Host.ExecutingObject.SkinnedMeshRenderer

RadioLecture seule​

SSceneBackgroundMusic Radio {get; }

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

Exemple

Lua
Radio = Space.Host.ExecutingObject.Radio

TerrainLecture seule​

STerrain Terrain {get; }

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

Exemple

Lua
Terrain = Space.Host.ExecutingObject.Terrain

AnalyticsEventLecture seule​

SAnalyticsEvent AnalyticsEvent {get; }

Exemple

Lua
analyticsEvent = Space.Host.ExecutingObject.AnalyticsEvent

GraphicRaycasterLecture seule​

SGraphicRaycaster GraphicRaycaster {get; }

Exemple

Lua
graphicRaycaster = Space.Host.ExecutingObject.GraphicRaycaster

ContentSizeFitterLecture seule​

SContentSizeFitter ContentSizeFitter {get; }

Exemple

Lua
contentSzeFitter = Space.Host.ExecutingObject.ContentSizeFitter

Active​

bool Active {get; set; }

Is this object Active in the scene

Exemple

Lua
Space.Host.ExecutingObject.Active = false
Lua
--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​

bool ActiveSelf {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.ActiveSelf = false

Layer​

int Layer {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.Layer = 21

TagLecture seule​

string Tag {get; }

Gets this objects Tag

Exemple

Lua
objectTag = Space.Host.ExecutingObject.Tag

Name​

string Name {get; set; }

Gets/sets the name of this object

Exemple

Lua
Space.Host.ExecutingObject.Name = 'Hello World!'

Moniker​

string? Moniker {get; set; }

Exemple

Lua
Space.Host.ExecutingObject.Moniker = 'New Moniker'

Parent​

SGameObject Parent {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.Parent = Space.Host.GetReference("TheOtherObject")

RootLecture seule​

SGameObject Root {get; }

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

Exemple

Lua
objectRoot = Space.Host.ExecutingObject.Root

ChildrenLecture seule​

SGameObject[] Children {get; }

Returns the list of direct children of this object.

Exemple

Lua
tableChildren = Space.Host.ExecutingObject.Children

WorldPosition​

SVector WorldPosition {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.WorldPosition = Vector.New(1,1,1)

LocalPosition​

SVector LocalPosition {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.LocalPosition = Vector.New(1,1,1)

WorldRotation​

SQuaternion WorldRotation {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.WorldRotation = Quaternion.Euler(0,180,0)

LocalRotation​

SQuaternion LocalRotation {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.LocalRotation = Quaternion.Euler(0,180,0)

LocalScale​

SVector LocalScale {get; set; }

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

Exemple

Lua
Space.Host.ExecutingObject.LocalScale = Vector.New(2,2,2)

WorldScaleLecture seule​

SVector WorldScale {get; }

Gets the current scale of this object relative to the scene

Exemple

Lua
worldScale = Space.Host.ExecutingObject.WorldScale

ForwardLecture seule​

SVector Forward {get; }

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

Exemple

Lua
vectorForward = Space.Host.ExecutingObject.Forward

UpLecture seule​

SVector Up {get; }

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

Exemple

Lua
vectorUp = Space.Host.ExecutingObject.Up
SVector Right {get; }

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

Exemple

Lua
vectorRight = Space.Host.ExecutingObject.Right

EventCalendarLecture seule​

SEventCalendar EventCalendar {get; }

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

Exemple

Lua
EventCalendar = Space.Host.ExecutingObject.EventCalendar