SGameObject
在此类中SubscribeToEvents
- 函数
- Subscribe
To Events - Set
Sibling Index - Set
As First Sibling - Set
As Last Sibling - Duplicate
- Instantiate
- Add
Hinge Joint - Add
Light - Add
Animator - Add
Audio Source - Add
Clickable - Get
Script - Get
Scripts In Children - Get
Script In Children - Get
Script In Parent - Get
Events - Get
All Events In Children - Get
Events In Children - Get
Events In Parent - Get
Resources - Get
All Resources In Children - Get
Resources In Children - Get
Resources In Parent - Get
Data - Get
All Data In Children - Get
Data In Children - Get
Data In Parent - Add
Rigidbody - Add
Nav Mesh Agent - Add
Seat - On
Awake - On
Start - On
Enable - On
Disable - On
Fixed Update - On
Late Update - On
Trigger Start - On
Trigger Stay - On
Trigger Exit - On
Collision Enter - On
Collision Stay - On
Collision Exit - On
Particle Collision - On
Particle Trigger - On
Update - On
Mouse Down - On
Application Quit - Compare
Tag - Set
Parent - Find
- Find
In Children - Destroy
- Get
Component - 属性
- Owner
- LocalID
- InventoryID
- Has
StableID - GlobalID
- Exists
- Hinge
Joint - Light
- Reflection
Probe - Light
In Child - Light
In Parent - Animator
- Animation
- Canvas
Group - Audio
- Floor
- Voice
Zone - Browser
- Director
- Renderer
- Vehicle
- Post
Process Volume - Archimatix
- Clickable
- Embedded
Video - Avatar
- Avatar
Appearance - Script
- State
Machine - Networking
- Events
- Resources
- Data
- Rigidbody
- Collider
- Box
Collider - Sphere
Collider - Capsule
Collider - Wheel
Collider - Character
Controller - Audio
Reactive - Attachment
Helper - Audio
Reactive Animation - Audio
Reactive Light - Audio
Reactive Particle System - Audio
Reactive Material - Audio
Reactive Transform - Trail
Renderer - Line
Renderer - UI
Layout - UI
Toggle - UI
Dropdown - UI
Button - UI
Text - UI
Slider - UI
Scrollbar - UI
Canvas - UI
Image - UI
Raw Image - UI
Input Field - UI
Tool Tip Hint - Camera
- Virtual
Camera - Cloth
- Mesh
Renderer - Furniture
- Nav
Mesh Agent - Nav
Mesh Obstacle - Particle
System - Rect
Transform - Seat
- Skinned
Mesh Renderer - Radio
- Terrain
- Analytics
Event - Graphic
Raycaster - Content
Size Fitter - Active
- Active
Self - Layer
- Tag
- Name
- Moniker
- Parent
- Root
- Children
- World
Position - Local
Position - World
Rotation - Local
Rotation - Local
Scale - World
Scale - Forward
- Up
- Right
- Event
Calendar
| 函数 | SubscribeToEvents | Causes this script to start listening to events on the object. |
| 函数 | SetSiblingIndex | Sets the sibling index. |
| 函数 | SetAsFirstSibling | This GameObject becomes the first Sibling |
| 函数 | SetAsLastSibling | This GameObject becomes the last Sibling |
| 函数 | Duplicate | Copies the object and returns a reference to the copy. |
| 函数 | Instantiate | Copy of Duplicate() for convenience |
| 函数 | AddHingeJoint | Adds a Hinge Joint component to this Game Object and returns its reference |
| 函数 | AddLight | Adds a Light component to the object. |
| 函数 | AddAnimator | Adds an Animator component to this Game Object and returns its reference |
| 函数 | AddAudioSource | Adds an AudioSource component to the object. |
| 函数 | AddClickable | Adds a Clickable component to the object. |
| 函数 | GetScript | Returns a Scripting Runtime component attached to this object by Component Name, or nil if none exist |
| 函数 | GetScriptsInChildren | Returns Scripting Runtime components attached to this object by Component Name or its children |
| 函数 | GetScriptInChildren | Returns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist |
| 函数 | GetScriptInParent | Returns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist |
| 函数 | GetEvents | – |
| 函数 | GetAllEventsInChildren | – |
| 函数 | GetEventsInChildren | – |
| 函数 | GetEventsInParent | – |
| 函数 | GetResources | – |
| 函数 | GetAllResourcesInChildren | – |
| 函数 | GetResourcesInChildren | – |
| 函数 | GetResourcesInParent | – |
| 函数 | GetData | Returns a Scripting Data component attached to this object by Component Name, or nil if none exist |
| 函数 | GetAllDataInChildren | Returns Scripting Data components attached to this object by Component Name or its children |
| 函数 | GetDataInChildren | Returns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist |
| 函数 | GetDataInParent | Returns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist |
| 函数 | AddRigidbody | Adds a Rigidbody component to the object. |
| 函数 | AddNavMeshAgent | Adds a NavMeshAgent component to the object. |
| 函数 | AddSeat | Adds a Seat component to the object. |
| 函数 | OnAwake | Binds a event to the Awake() event. |
| 函数 | OnStart | Binds a event to the Start() event. |
| 函数 | OnEnable | Binds a event to the OnEnable() event. |
| 函数 | OnDisable | Binds a event to the OnDisable() event. |
| 函数 | OnFixedUpdate | Binds a event to the OnFixedUpdate() event. |
| 函数 | OnLateUpdate | Binds a event to the OnLateUpdate() event. |
| 函数 | OnTriggerStart | When a GameObject collides with another GameObject, Unity calls OnTriggerEnter. |
| 函数 | OnTriggerStay | OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger. |
| 函数 | OnTriggerExit | OnTriggerExit is called when the Collider other has stopped touching the trigger. |
| 函数 | OnCollisionEnter | OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider. |
| 函数 | OnCollisionStay | OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider. |
| 函数 | OnCollisionExit | OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider. |
| 函数 | OnParticleCollision | OnParticleCollision is called when a particle hits a Collider. |
| 函数 | OnParticleTrigger | Binds a new event handler for the OnParticleTrigger event. |
| 函数 | OnUpdate | Binds a event to the OnUpdate() event. |
| 函数 | OnMouseDown | Binds a event to the OnMouseDown() event. |
| 函数 | OnApplicationQuit | Binds a new event handler for the On Application Quit event |
| 函数 | CompareTag | – |
| 函数 | SetParent | Make this GameObject the child of GameObject 'other' |
| 函数 | Find | Find and return a reference to GameObject with name 'name' |
| 函数 | FindInChildren | Find and return a reference to GameObject with name 'name' including children |
| 函数 | Destroy | Schedules this object for deletion at the end of the frame |
| 函数 | GetComponent | – |
| 属性 | Owner | Returns the GameObject's Owner |
| 属性 | LocalID | Returns the GameObject's Local ID |
| 属性 | InventoryID | Return's the GameObject's InventoryID |
| 属性 | HasStableID | Returns true if GameObject has Stable ID |
| 属性 | GlobalID | Returns the global ID of the GameObject |
| 属性 | Exists | Does this object still exist in the scene (returns false if the object has been deleted via Destroy();) |
| 属性 | HingeJoint | Returns a HingeJoint component attached to this object, or nil if none exist |
| 属性 | Light | Returns a reference to a Light component on the object. |
| 属性 | ReflectionProbe | Returns a ReflectionProbe component attached to this object, or nil if none exist |
| 属性 | LightInChild | Returns a Light component attached to this object or its children, or nil if none exist |
| 属性 | LightInParent | Returns a Light component attached to this object or it's parent, or nil if none exist |
| 属性 | Animator | Returns a reference to a Animator component on the object. |
| 属性 | Animation | Returns an Animation component attached to this object, or nil if none exist Animation is a legacy component and should not be confused with Animator |
| 属性 | CanvasGroup | Returns Canvas Group component attached to this object, or nil if none exist |
| 属性 | Audio | Returns a reference to a AudioSource component on the object. |
| 属性 | Floor | Returns a RoomFloor component attached to this object, or nil if none exist |
| 属性 | VoiceZone | Returns a VoiceZone component attached to this object, or nil if none exist |
| 属性 | Browser | Returns a reference to a BrowserSurface component on the object. |
| 属性 | Director | Returns a PlayableDirector component attached to this object, or nil if none exist |
| 属性 | Renderer | Returns a reference to a Renderer component on the object. |
| 属性 | Vehicle | Returns a Modular Vehicle component attached to this object, or nil if none exist |
| 属性 | PostProcessVolume | Returns a Post Process Volume component attached to this object, or nil if none exist |
| 属性 | Archimatix | Returns a Archimatix Model ("AXModel" component) - or Nil if nothing exists |
| 属性 | Clickable | Returns a reference to a Clickable component on the object. |
| 属性 | EmbeddedVideo | Returns an Embedded Video component attached to this object, or nil if none exist (may not work within editor) |
| 属性 | Avatar | A reference to an Avatar component on the GameObject. |
| 属性 | AvatarAppearance | Returns a AvatarAppearance component attached to this object, or nil if none exist |
| 属性 | Script | Returns a Scripting Runtime component attached to this object, or nil if none exist |
| 属性 | StateMachine | Returns a State Machine component attached to this object, or nil if none exist |
| 属性 | Networking | Returns a Simple Networking component attached to this object, or nil if none exists |
| 属性 | Events | – |
| 属性 | Resources | – |
| 属性 | Data | Returns a Scripting Data component attached to this object, or nil if none exist |
| 属性 | Rigidbody | Returns a reference to a Rigidbody component on the object. |
| 属性 | Collider | Returns a reference to a Collider component on the object. |
| 属性 | BoxCollider | Returns a Box Collider component attached to this object, or nil if none exist |
| 属性 | SphereCollider | Returns a Sphere Collider component attached to this object, or nil if none exist |
| 属性 | CapsuleCollider | Returns a Capsule Collider component attached to this object, or nil if none exist |
| 属性 | WheelCollider | Returns a WheelCollider component attached to this object, or nil if none exist |
| 属性 | CharacterController | Returns a Character Controller component attached to this object, or nil if none exist |
| 属性 | AudioReactive | Returns the first Audio Reactive component attached to this object, or nil if none exist |
| 属性 | AttachmentHelper | Returns the first Attachment Helper component attached to this object, or nil if none exist |
| 属性 | AudioReactiveAnimation | Returns the first Audio Reactive Animation component attached to this object, or nil if none exist |
| 属性 | AudioReactiveLight | Returns the first Audio Reactive Light component attached to this object, or nil if none exist |
| 属性 | AudioReactiveParticleSystem | Returns the first Audio Reactive Particle System component attached to this object, or nil if none exist |
| 属性 | AudioReactiveMaterial | Returns the first Audio Reactive Material component attached to this object, or nil if none exist |
| 属性 | AudioReactiveTransform | Returns the first Audio Reactive Transform component attached to this object, or nil if none exist |
| 属性 | TrailRenderer | Returns a Trail Renderer component attached to this object, or nil if none exist |
| 属性 | LineRenderer | Returns a Line Renderer component attached to this object, or nil if none exist |
| 属性 | UILayout | Returns a Renderer component attached to this object, or nil if none exist |
| 属性 | UIToggle | Returns a Unity uGUI Toggle component attached to this object, or nil if none exist |
| 属性 | UIDropdown | Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist |
| 属性 | UIButton | Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist |
| 属性 | UIText | Returns a reference to a UI.Text component on the object. |
| 属性 | UISlider | Returns a Unity uGUI Slider component attached to this object, or nil if none exist |
| 属性 | UIScrollbar | Returns a Unity uGUI Scrollbar component attached to this object, or nil if none exist |
| 属性 | UICanvas | Returns a Unity uGUI Canvas component attached to this object, or nil if none exist |
| 属性 | UIImage | Returns a Unity uGUI Image component attached to this object, or nil if none exist |
| 属性 | UIRawImage | Returns a Unity uGUI Text component attached to this object, or nil if none exist |
| 属性 | UIInputField | Returns a Unity uGUI Text component attached to this object, or nil if none exist |
| 属性 | UIToolTipHint | – |
| 属性 | Camera | – |
| 属性 | VirtualCamera | Returns a VirtualCamera component attached to this object, or nil if none exists |
| 属性 | Cloth | Returns a Cloth component attached to this object, or nil if none exists |
| 属性 | MeshRenderer | Returns a MeshRenderer component attached to this object, or nil if none exists |
| 属性 | Furniture | Returns a Furniture component attached to this object, or nil if none exists |
| 属性 | NavMeshAgent | Adds a NavMeshAgent component to the object. |
| 属性 | NavMeshObstacle | Returns a NavMeshObstacle component attached to this object, or nil if none exists |
| 属性 | ParticleSystem | Returns a ParticleSystem component attached to this object, or nil if none exists |
| 属性 | RectTransform | Returns a RectTransform component attached to this object, or nil if none exists |
| 属性 | Seat | Returns a reference to a Seat component on the object. |
| 属性 | SkinnedMeshRenderer | Returns a SkinnedMeshRenderer component attached to this object, or nil if none exists |
| 属性 | Radio | Returns a SceneBackgroundMusic component attached to this object, or nil if none exists |
| 属性 | Terrain | Returns a Terrain component attached to this object, or nil if none exists |
| 属性 | AnalyticsEvent | – |
| 属性 | GraphicRaycaster | – |
| 属性 | ContentSizeFitter | – |
| 属性 | Active | Is this object Active in the scene |
| 属性 | ActiveSelf | Returns true if GameObject is Active (even if it's parent is not active) |
| 属性 | Layer | Gets/Sets the object onto a particular layer (0-31) |
| 属性 | Tag | Gets this objects Tag |
| 属性 | Name | Gets/sets the name of this object |
| 属性 | Moniker | – |
| 属性 | Parent | Gets/sets the parent GameObject of this object. |
| 属性 | Root | Gets the root of this object group - may be this object. |
| 属性 | Children | Returns the list of direct children of this object. |
| 属性 | WorldPosition | Gets or sets the current position of this object relative to the scene |
| 属性 | LocalPosition | Gets or sets the current position of this object relative to the objects parent, taking into account local position/scale/rotation |
| 属性 | WorldRotation | Gets or sets the current rotation of this object relative to the scene |
| 属性 | LocalRotation | Gets or sets the current rotation of this object relative to the parent object |
| 属性 | LocalScale | Gets or sets the current scale of this object relative to the parent |
| 属性 | WorldScale | Gets the current scale of this object relative to the scene |
| 属性 | Forward | Returns the forward direction vector of this game object (blue arrow) |
| 属性 | Up | Returns the up direction vector of this game object (green arrow) |
| 属性 | Right | Returns the right direction vector of this game object (red arrow) |
| 属性 | EventCalendar | Returns an EventCalendar component attached to this object, or nil if none exists |
函数
SubscribeToEvents
Causes this script to start listening to events on the object.
返回值
void
示例
Space.Host.ExecutingObject.SubscribeToEvents()
SetSiblingIndex
Sets the sibling index.
Use this to change the sibling index of the GameObject. If a GameObject shares a parent with other GameObjects and are on the same level (i.e. they share the same direct parent), these GameObjects are known as siblings. The sibling index shows where each GameObject sits in this sibling hierarchy.
Use SetSiblingIndex to change the GameObject’s place in this hierarchy. When the sibling index of a GameObject is changed, its order in the Hierarchy window will also change.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| newIndex | int | – |
返回值
void
示例
Space.Host.ExecutingObject.SetSiblingIndex(2)
SetAsFirstSibling
This GameObject becomes the first Sibling
返回值
void
示例
Space.Host.ExecutingObject.SetAsFirstSibling()
SetAsLastSibling
This GameObject becomes the last Sibling
返回值
void
示例
Space.Host.ExecutingObject.SetAsLastSibling()
Duplicate
Copies the object and returns a reference to the copy. Equivalent to calling Instantiate() in Unity
返回值
SGameObject
示例
local copy = Space.Host.ExecutingObject.Duplicate()
--this script will make this object, once clicked, duplicate itself, then the duplicate
--moves up and then duplicate itself again and the duplicate move down (total 3 vertically aligned)
--(Example: cells multiplying)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
local firstDuplicate = thisGameObject.Duplicate()
firstDuplicate.WorldPosition = firstDuplicate.WorldPosition + firstDuplicate.Up
local secondDuplicate = thisGameObject.Duplicate()
secondDuplicate.WorldPosition = secondDuplicate.WorldPosition - secondDuplicate.Up
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to watch me multiply "
thisGameObject.Clickable.OnClick(OnClick)
Instantiate
Copy of Duplicate() for convenience
返回值
SGameObject
示例
NewGameObject = Space.Host.ExecutingObject.Instantiate()
--this script will make this object, once clicked, duplicate itself, then the duplicate
--moves up and then duplicate itself again and the duplicate move down (total 3 vertically aligned)
--(Example: cells multiplying)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
local firstDuplicate = thisGameObject.Instantiate()
firstDuplicate.WorldPosition = firstDuplicate.WorldPosition + firstDuplicate.Up
local secondDuplicate = thisGameObject.Instantiate()
secondDuplicate.WorldPosition = secondDuplicate.WorldPosition - secondDuplicate.Up
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to watch me multiply "
thisGameObject.Clickable.OnClick(OnClick)
AddHingeJoint
Adds a Hinge Joint component to this Game Object and returns its reference
返回值
SHingeJoint
示例
NewHingeJoint = Space.Host.ExecutingObject.AddHingeJoint()
--clicking this object will add a Hinge Joint component to it at runtime
thisObject = Space.Host.ExecutingObject
OnClick = function()
HJ = thisObject.AddHingeJoint()
end
thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
AddLight
Adds a Light component to the object.
返回值
SLight
示例
newLightComponent = Space.Host.ExecutingObject.AddLight()
AddAnimator
Adds an Animator component to this Game Object and returns its reference
返回值
SAnimator
示例
NewAnimator = Space.Host.ExecutingObject.AddAnimator()
--clicking this object will add an animator to it and controller at runtime
thisObject = Space.Host.ExecutingObject
theResource = Space.GetResource("An Animator Controller") -- add controller to resources in Scripting Runtime
OnClick = function()
Animator = thisObject.AddAnimator()
Animator.Controller = theResource
end
thisObject.AddClickable()
thisObject.Clickable.OnClick(OnClick)
AddAudioSource
Adds an AudioSource component to the object.
返回值
SAudioSource
示例
newAudioSourceComponent = Space.Host.ExecutingObject.AddAudioSource()
AddClickable
Adds a Clickable component to the object.
返回值
SClickable
示例
newClikcableComponent = Space.Host.ExecutingObject.AddClickable()
GetScript
Returns a Scripting Runtime component attached to this object by Component Name, or nil if none exist
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingRuntime
示例
scriptingRuntime = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")
GetScriptsInChildren
Returns Scripting Runtime components attached to this object by Component Name or its children
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
List< SScriptingRuntime >
示例
tableScriptsInChildren = Space.Host.ExecutingObject.GetScriptsInChildren("scriptingruntimecomponentname",true)
GetScriptInChildren
Returns a Scripting Runtime component attached to this object or its children by Component Name, or nil if none exist
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
SScriptingRuntime
示例
scriptingRuntimeInChildren = Space.Host.ExecutingObject.GetScriptInChildren("scriptingruntimecomponentname",true)
GetScriptInParent
Returns a Scripting Runtime component attached to this object or its parents by Component Name, or nil if none exist
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingRuntime
示例
scriptingRuntimeInParent = Space.Host.ExecutingObject.GetScript("scriptingruntimecomponentname")
GetEvents
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingEvents
示例
scriptingEvent = Space.Host.ExecutingObject.GetEvents('ScriptingEventsComponentName')
GetAllEventsInChildren
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
List< SScriptingEvents >
示例
tableScriptingEvent = Space.Host.ExecutingObject.GetAllEventsInChildren
GetEventsInChildren
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
SScriptingEvents
示例
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName')
--or
scriptingEvent = Space.Host.ExecutingObject.GetEventsInChildren('ScriptingEventsComponentName', true)
GetEventsInParent
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingEvents
示例
scriptingEvent = Space.Host.ExecutingObject.GetEventsInParent('ScriptingEventsComponentName')
GetResources
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingResources
示例
Space.Host.ExecutingObject.GetResources('ResourcesComponentName')
GetAllResourcesInChildren
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
List< SScriptingResources >
示例
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetAllResourcesInChildren('ScriptingResourcesComponentName', true)
GetResourcesInChildren
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
SScriptingResources
示例
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName')
--or
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInChildren('ScriptingResourcesComponentName', true)
GetResourcesInParent
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingResources
示例
tableScriptingResources = Space.Host.ExecutingObject.GetResourcesInParent('ScriptingResourcesComponentName')
GetData
Returns a Scripting Data component attached to this object by Component Name, or nil if none exist
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingData
示例
scriptingData = Space.Host.ExecutingObject.GetData("scriptingdatacomponentname")
GetAllDataInChildren
Returns Scripting Data components attached to this object by Component Name or its children
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
List< SScriptingData >
示例
tableScriptingDataInChildren = Space.Host.ExecutingObject.GetAllDataInChildren("scriptingdatacomponentname",true)
GetDataInChildren
Returns a Scripting Data component attached to this object or its children by Component Name, or nil if none exist
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| includeInactive | bool | false |
返回值
SScriptingData
示例
scriptingDataInChildren = Space.Host.ExecutingObject.GetDataInChildren("scriptingdatacomponentname",true)
GetDataInParent
Returns a Scripting Data component attached to this object or its parents by Component Name, or nil if none exist
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SScriptingData
示例
scriptingDataInParent = Space.Host.ExecutingObject.GetDataInParent("scriptingdatacomponentname")
AddRigidbody
Adds a Rigidbody component to the object.
返回值
SRigidbody
示例
newRigibodyComponent = Space.Host.ExecutingObject.AddRigidbody()
AddNavMeshAgent
Adds a NavMeshAgent component to the object.
返回值
SNavMeshAgent
示例
newNavMeshAgentComponent = Space.Host.ExecutingObject.AddNavMeshAgent()
AddSeat
Adds a Seat component to the object.
返回值
SSeat
示例
newSeatComponent = Space.Host.ExecutingObject.AddSeat()
OnAwake
Binds a event to the Awake() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnAwake(F)
OnStart
Binds a event to the Start() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnStart(F)
OnEnable
Binds a event to the OnEnable() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnEnable(F)
OnDisable
Binds a event to the OnDisable() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnDisable(F)
OnFixedUpdate
Binds a event to the OnFixedUpdate() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnFixedUpdate(F)
--this script will make this object move forward each physics frame
thisObject = Space.Host.ExecutingObject
OnFixedUpdate = function()
thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 )
--unlike OnUpdate we did not multiply by Space.DeltaTime
--because OnFixedUpdate executes at the same rate regardless
end
thisObject.OnFixedUpdate(OnFixedUpdate)
OnLateUpdate
Binds a event to the OnLateUpdate() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnLateUpdate(F)
--this script will make this object move forward each frame
--but it will be last to move among other objects (read about OnLateUpdate)
--(example: camera movement)
thisObject = Space.Host.ExecutingObject
OnLateUpdate = function()
thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 * Space.DeltaTime)
--we multipy by Space.DeltaTime so that it behaves the same for all players
--even though they have different FPS (frames per second)
end
thisObject.OnLateUpdate(OnLateUpdate)
OnTriggerStart
When a GameObject collides with another GameObject, Unity calls OnTriggerEnter.
OnTriggerEnter happens on the FixedUpdate function when two GameObjects collide. The Colliders involved are not always at the point of initial contact.
Note: Both GameObjects must contain a Collider component. One must have Collider.isTrigger enabled, and contain a Rigidbody. If both GameObjects have Collider.isTrigger enabled, no collision happens. The same applies when both GameObjects do not have a Rigidbody component.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnTriggerStart = function(SGameObject)
Space.Log("Trigger Start")
end
this.OnTriggerStart (OnTriggerStart )
--the below scipt makes this object a boundary area where flying gets blocked
--while player is in it and flying is allowed once player leaves it
--(Example: No fly zone)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
OnTriggerStart = function(TriggerStarter)
if TriggerStarter.Root.Avatar ~= nil then
if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = true
end
end
end
OnTriggerExit = function(TriggerExiter)
if TriggerExiter.Root.Avatar ~= nil then
if TriggerExiter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = false
end
end
end
thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerExit(OnTriggerExit)
OnTriggerStay
OnTriggerStay is called almost all the frames for every Collider other that is touching the trigger. The function is on the physics timer so it won't necessarily run every frame.
This message is sent to the trigger and the collider that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnTriggerStay = function(SGameObject)
Space.Log("Trigger Stay")
end
this.OnTriggerStay(OnTriggerStay)
--the below scipt makes this object a boundary area where any user entering it
--will be blocked from movement for 10 seconds, then the object will release controls and
--destry itself after that
--(Example: freezing trap)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
FrozenTime = 0.0
OnTriggerStart = function(TriggerStarter)
if TriggerStarter.Root.Avatar ~= nil then
if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockMovement = true
end
end
end
OnTriggerStay = function(TriggerStayer)
if TriggerStayer.Root.Avatar ~= nil then
if TriggerStayer.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
FrozenTime = FrozenTime + Space.DeltaTime
if FrozenTime > 20 then
Space.Scene.PlayerAvatar.BlockMovement = false
thisGameObject.Destroy()
end
end
end
end
thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerStay(OnTriggerStay)
OnTriggerExit
OnTriggerExit is called when the Collider other has stopped touching the trigger.
This message is sent to the trigger and the Collider that touches the trigger. Notes: Trigger events are only sent if one of the Colliders also has a Rigidbody attached. Trigger events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions. OnTriggerExit occurs on the FixedUpdate after the Colliders have stopped touching. The Colliders involved are not guaranteed to be at the point of initial separation.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnTriggerExit = function(SGameObject)
Space.Log("Trigger Stay")
end
this.OnTriggerExit(OnTriggerExit)
--the below scipt makes this object a boundary area where flying gets blocked
--while player is in it and flying is allowed once player leaves it
--(Example: No fly zone)
--[This object's collider needs to be set as IsTrigger (Please read about OnTriggerStart for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
OnTriggerStart = function(TriggerStarter)
if TriggerStarter.Root.Avatar ~= nil then
if TriggerStarter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = true
end
end
end
OnTriggerExit = function(TriggerExiter)
if TriggerExiter.Root.Avatar ~= nil then
if TriggerExiter.Root.Avatar.Username == Space.Scene.PlayerAvatar.Username then
Space.Scene.PlayerAvatar.BlockFly = false
end
end
end
thisGameObject.OnTriggerStart(OnTriggerStart)
thisGameObject.OnTriggerExit(OnTriggerExit)
OnCollisionEnter
OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
In contrast to OnTriggerStart, OnCollisionEnter is passed the SPhysicsHit class and not a Collider (GameObject). The SPhysicsHit class contains information, for example, about contact points and impact velocity. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Action< SPhysicsHit > | – |
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnCollisionEnter = function(SPhysicsHit)
Space.Log("Collision Enter")
end
this.OnCollisionEnter(OnCollisionEnter)
--this script will make this object delete itself if it collides with something
--(Example: grenade)
--[Make sure you add a rigibody to this object (read above about "collisions")
thisGameObject = Space.Host.ExecutingObject
OnCollisionEnter = function(SPhysicsHit)
thisGameObject.Destroy()
end
thisGameObject.OnCollisionEnter(OnCollisionEnter)
OnCollisionStay
OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
In contrast to OnTriggerStay, OnCollisionStay is passed the SPhysicsHit class and not a Collider (GameObject). The SPhysicsHit class contains information about contact points, impact velocity etc. If you don't use collisionInfo in the function, leave out the collisionInfo parameter as this avoids unneccessary calculations. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions. Collision stay events are not sent for sleeping Rigidbodies.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Action< SPhysicsHit > | – |
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnCollisionStay = function(SPhysicsHit)
Space.Log("Collision Stay")
end
this.OnCollisionStay(OnCollisionStay)
--this script will make this object delete itself if
--it is being touched for around 10 seconds
--(Example: a flag being captured)
--[Make sure this object has collider/rigidbody (read above about "collisions" for troubleshooting)]
thisGameObject = Space.Host.ExecutingObject
touchedTime = 0.0
OnCollisionStay = function(SPhysicsHit)
touchedTime = touchedTime + Space.DeltaTime
if touchedTime > 25 then
thisGameObject.Destroy()
end
end
thisGameObject.OnCollisionStay(OnCollisionStay)
OnCollisionExit
OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
In contrast to OnTriggerExit, OnCollisionExit is passed the SPhysicsHit class and not a Collider. The SPhysicsHit class contains information about contact points, impact velocity etc. If you don't use collisionInfo in the function, leave out the collisionInfo parameter as this avoids unneccessary calculations. Notes: Collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached. Collision events will be sent to disabled MonoBehaviours, to allow enabling Behaviours in response to collisions.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Action< SPhysicsHit > | – |
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnCollisionExit = function(SPhysicsHit)
Space.Log("Collision Exit")
end
this.OnCollisionExit(OnCollisionExit)
--this script will make this object destroy itself when an object
--that collided with it exits the collission
--(Example: landmine)
--[Make sure you add a rigibody to this object (read above about "collisions")
thisGameObject = Space.Host.ExecutingObject
OnCollisionExit = function(SPhysicsHit)
thisGameObject.Destroy()
end
thisGameObject.OnCollisionExit(OnCollisionExit)
OnParticleCollision
OnParticleCollision is called when a particle hits a Collider.
This can be used to apply damage to a GameObject when hit by particles.
This message is sent to scripts attached to Particle Systems and to the Collider that was hit.
When OnParticleCollision is invoked from a script attached to a GameObject with a Collider, the GameObject parameter represents the ParticleSystem. The Collider receives at most one message per Particle System that collided with it in any given frame even when the Particle System struck the Collider with multiple particles in the current frame.
When OnParticleCollision is invoked from a script attached to a ParticleSystem, the GameObject parameter represents a GameObject with an attached Collider struck by the ParticleSystem. The ParticleSystem receives at most one message per Collider that is struck.
Messages are only sent if you enable Send Collision Messages in the Inspector of the Particle System Collision module.
The OnParticleCollision can be a co-routine. Simply use the yield statement in the function.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Action< SGameObject > | – |
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnParticleCollision = function(GameObject)
Space.Log("Particle Collision")
end
this.OnParticleCollision(OnParticleCollision)
OnParticleTrigger
Binds a new event handler for the OnParticleTrigger event.
OnParticleTrigger event is called when any particles in a Particle System meet the conditions in the trigger module.
This can be used to kill or modify particles that are inside or outside a collision volume.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnParticleTrigger = function(GameObject)
Space.Log("Particle Trigger Event")
end
this.OnParticleTrigger(OnParticleTrigger)
OnUpdate
Binds a event to the OnUpdate() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnUpdate(F)
--this script will make this object move forward each frame
thisObject = Space.Host.ExecutingObject
OnUpdate = function()
thisObject.WorldPosition = thisObject.WorldPosition + (thisObject.Forward * 0.01 * Space.DeltaTime)
--we multipy by Space.DeltaTime so that it behaves the same for all players
--even though they have different FPS (frames per second)
end
thisObject.OnUpdate(OnUpdate)
OnMouseDown
Binds a event to the OnMouseDown() event.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
function F()
Space.Log("bound")
end
Space.Host.ExecutingObject.OnMouseDown(F)
OnApplicationQuit
Binds a new event handler for the On Application Quit event
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| e | Closure | – |
返回值
void
示例
this = Space.Host.ExecutingObject
OnApplicationQuit = function()
Space.Log("Application Quit")
end
this.OnApplicationQuit(OnApplicationQuit)
CompareTag
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| tag | string | – |
返回值
bool
示例
isSame = Space.Host.ExecutingObject.CompareTag('tagname')
SetParent
Make this GameObject the child of GameObject 'other'
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| other | SGameObject | – |
| worldPositionStays | bool | true |
返回值
void
示例
Space.Host.ExecutingObject.SetParent(otherObjectReference,true)
--this script will set your avatar's "right hand" as parent of this object
--this way this object will be a child of your right hand and therefore move with it
--(Example: clicking on a gun to equip it)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
RightHand = Space.Scene.PlayerAvatar.FindBone("RightHand")
thisGameObject.SetParent(RightHand)
thisGameObject.LocalPosition = Vector.New(0,0,0) -- resetting position to match hand
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Click to Equip "
thisGameObject.Clickable.OnClick(OnClick)
Find
Find and return a reference to GameObject with name 'name'
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SGameObject
示例
FoundObject = Space.Host.ExecutingObject.Find("GameObject Name")
FindInChildren
Find and return a reference to GameObject with name 'name' including children
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SGameObject
示例
FoundObjectInChildren = Space.Host.ExecutingObject.FindInChildren("GameObject Name")
Destroy
Schedules this object for deletion at the end of the frame
返回值
void
示例
Space.Host.ExecutingObject.Destroy()
GetComponent
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
SComponent
属性
Owner只读
Returns the GameObject's Owner
示例
Owner = Space.Host.ExecutingObject.Owner
LocalID只读
Returns the GameObject's Local ID
示例
LocalID = Space.Host.ExecutingObject.LocalID
InventoryID只读
Return's the GameObject's InventoryID
示例
InventoryID = Space.Host.ExecutingObject.InventoryID
HasStableID只读
Returns true if GameObject has Stable ID
示例
HasStableID = Space.Host.ExecutingObject.HasStableID
GlobalID只读
Returns the global ID of the GameObject
示例
GlobalID = Space.Host.ExecutingObject.GlobalID
Exists只读
Does this object still exist in the scene (returns false if the object has been deleted via Destroy();)
示例
doesExist = Space.Host.ExecutingObject.Exists
HingeJoint只读
Returns a HingeJoint component attached to this object, or nil if none exist
示例
HingeJoint = Space.Host.ExecutingObject.HingeJoint
Light只读
Returns a reference to a Light component on the object. Will return null if it does not exist.
示例
newLightComponent = Space.Host.ExecutingObject.Light
ReflectionProbe只读
Returns a ReflectionProbe component attached to this object, or nil if none exist
示例
ReflectionProbe = Space.Host.ExecutingObject.ReflectionProbe
LightInChild只读
Returns a Light component attached to this object or its children, or nil if none exist
示例
LightInChild = Space.Host.ExecutingObject.LightInChild
LightInParent只读
Returns a Light component attached to this object or it's parent, or nil if none exist
示例
LightInParent = Space.Host.ExecutingObject.LightInParent
Animator只读
Returns a reference to a Animator component on the object. Will return null if it does not exist.
示例
animatorComponent = Space.Host.ExecutingObject.Animator
Animation只读
Returns an Animation component attached to this object, or nil if none exist Animation is a legacy component and should not be confused with Animator
示例
Animation = Space.Host.ExecutingObject.Animation
CanvasGroup只读
Returns Canvas Group component attached to this object, or nil if none exist
示例
CanvasGroup = Space.Host.ExecutingObject.CanvasGroup
Audio只读
Returns a reference to a AudioSource component on the object. Will return null if it does not exist.
示例
newAudioComponent = Space.Host.ExecutingObject.Audio
Floor只读
Returns a RoomFloor component attached to this object, or nil if none exist
示例
Floor = Space.Host.ExecutingObject.Floor
VoiceZone只读
Returns a VoiceZone component attached to this object, or nil if none exist
示例
VoiceZone = Space.Host.ExecutingObject.VoiceZone
Browser只读
Returns a reference to a BrowserSurface component on the object. Will return null if it does not exist.
示例
newBrowserComponent = Space.Host.ExecutingObject.Browser
Director只读
Returns a PlayableDirector component attached to this object, or nil if none exist
示例
Director = Space.Host.ExecutingObject.Director
Renderer只读
Returns a reference to a Renderer component on the object. Will return null if it does not exist.
示例
renderer = Space.Host.ExecutingObject.Renderer
Vehicle只读
Returns a Modular Vehicle component attached to this object, or nil if none exist
示例
Vehicle = Space.Host.ExecutingObject.Vehicle
PostProcessVolume只读
Returns a Post Process Volume component attached to this object, or nil if none exist
示例
PostProcessVolume = Space.Host.ExecutingObject.PostProcessVolume
Archimatix只读
Returns a Archimatix Model ("AXModel" component) - or Nil if nothing exists
示例
Archimatix = Space.Host.ExecutingObject.Archimatix
Clickable只读
Returns a reference to a Clickable component on the object. Will return null if it does not exist.
示例
clickableComponent = Space.Host.ExecutingObject.Clickable
EmbeddedVideo只读
Returns an Embedded Video component attached to this object, or nil if none exist (may not work within editor)
示例
EmbeddedVideo = Space.Host.ExecutingObject.EmbeddedVideo
Avatar只读
A reference to an Avatar component on the GameObject.
示例
Avatar = Space.Host.ExecutingObject.Avatar
AvatarAppearance只读
Returns a AvatarAppearance component attached to this object, or nil if none exist
示例
AvatarAppearance = Space.Host.ExecutingObject.AvatarAppearance
Script只读
Returns a Scripting Runtime component attached to this object, or nil if none exist
示例
Script = Space.Host.ExecutingObject.Script
StateMachine只读
Returns a State Machine component attached to this object, or nil if none exist
示例
StateMachine = Space.Host.ExecutingObject.StateMachine
Networking只读
Returns a Simple Networking component attached to this object, or nil if none exists
示例
SimpleNetworking = Space.Host.ExecutingObject.Networking
Events只读
示例
eventsComponent = Space.Host.ExecutingObject.Events
Resources只读
示例
resourcesComponent = Space.Host.ExecutingObject.Resources
Data只读
Returns a Scripting Data component attached to this object, or nil if none exist
示例
Data = Space.Host.ExecutingObject.Data
Rigidbody只读
Returns a reference to a Rigidbody component on the object. Will return null if it does not exist.
示例
rigidbodyComponent = Space.Host.ExecutingObject.Rigidbody
Collider只读
Returns a reference to a Collider component on the object. Will return null if it does not exist.
示例
colliderComponent = Space.Host.ExecutingObject.Collider
BoxCollider只读
Returns a Box Collider component attached to this object, or nil if none exist
示例
BoxCollider = Space.Host.ExecutingObject.BoxCollider
SphereCollider只读
Returns a Sphere Collider component attached to this object, or nil if none exist
示例
SphereCollider = Space.Host.ExecutingObject.SphereCollider
CapsuleCollider只读
Returns a Capsule Collider component attached to this object, or nil if none exist
示例
CapsuleCollider = Space.Host.ExecutingObject.CapsuleCollider
WheelCollider只读
Returns a WheelCollider component attached to this object, or nil if none exist
示例
WheelCollider = Space.Host.ExecutingObject.WheelCollider
CharacterController只读
Returns a Character Controller component attached to this object, or nil if none exist
示例
CharacterController = Space.Host.ExecutingObject.CharacterController
AudioReactive只读
Returns the first Audio Reactive component attached to this object, or nil if none exist
示例
AudioReactive = Space.Host.ExecutingObject.AudioReactive
AttachmentHelper只读
Returns the first Attachment Helper component attached to this object, or nil if none exist
示例
AttachmentHelper = Space.Host.ExecutingObject.AttachmentHelper
AudioReactiveAnimation只读
Returns the first Audio Reactive Animation component attached to this object, or nil if none exist
示例
AudioReactiveAnimation = Space.Host.ExecutingObject.AudioReactiveAnimation
AudioReactiveLight只读
Returns the first Audio Reactive Light component attached to this object, or nil if none exist
示例
AudioReactiveLight = Space.Host.ExecutingObject.AudioReactiveLight
AudioReactiveParticleSystem只读
Returns the first Audio Reactive Particle System component attached to this object, or nil if none exist
示例
AudioReactiveParticleSystem = Space.Host.ExecutingObject.AudioReactiveParticleSystem
AudioReactiveMaterial只读
Returns the first Audio Reactive Material component attached to this object, or nil if none exist
示例
AudioReactiveMaterial = Space.Host.ExecutingObject.AudioReactiveMaterial
AudioReactiveTransform只读
Returns the first Audio Reactive Transform component attached to this object, or nil if none exist
示例
AudioReactiveTransform = Space.Host.ExecutingObject.AudioReactiveTransform
TrailRenderer只读
Returns a Trail Renderer component attached to this object, or nil if none exist
示例
TrailRenderer = Space.Host.ExecutingObject.TrailRenderer
LineRenderer只读
Returns a Line Renderer component attached to this object, or nil if none exist
示例
LineRenderer = Space.Host.ExecutingObject.LineRenderer
UILayout只读
Returns a Renderer component attached to this object, or nil if none exist
示例
UILayout = Space.Host.ExecutingObject.UILayout
UIToggle只读
Returns a Unity uGUI Toggle component attached to this object, or nil if none exist
示例
UIToggle = Space.Host.ExecutingObject.UIToggle
UIDropdown只读
Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist
示例
UIDropdown = Space.Host.ExecutingObject.UIDropdown
UIButton只读
Returns a Unity uGUI Dropdown component attached to this object, or nil if none exist
示例
UIButton = Space.Host.ExecutingObject.UIButton
UIText只读
Returns a reference to a UI.Text component on the object. Will return null if it does not exist.
示例
uitext = Space.Host.ExecutingObject.UIText
UISlider只读
Returns a Unity uGUI Slider component attached to this object, or nil if none exist
示例
UISlider = Space.Host.ExecutingObject.UISlider
UIScrollbar只读
Returns a Unity uGUI Scrollbar component attached to this object, or nil if none exist
示例
UIScrollbar = Space.Host.ExecutingObject.UIScrollbar
UICanvas只读
Returns a Unity uGUI Canvas component attached to this object, or nil if none exist
示例
UICanvas = Space.Host.ExecutingObject.UICanvas
UIImage只读
Returns a Unity uGUI Image component attached to this object, or nil if none exist
示例
UIImage = Space.Host.ExecutingObject.UIImage
UIRawImage只读
Returns a Unity uGUI Text component attached to this object, or nil if none exist
示例
UIRawImage = Space.Host.ExecutingObject.UIRawImage
UIInputField只读
Returns a Unity uGUI Text component attached to this object, or nil if none exist
示例
UIInputField = Space.Host.ExecutingObject.UIInputField
UIToolTipHint只读
示例
tooltipHint = Space.Host.ExecutingObject.UIToolTipHint
Camera只读
示例
camera = Space.Host.ExecutingObject.Camera
VirtualCamera只读
Returns a VirtualCamera component attached to this object, or nil if none exists
示例
VirtualCamera = Space.Host.ExecutingObject.VirtualCamera
Cloth只读
Returns a Cloth component attached to this object, or nil if none exists
示例
Cloth = Space.Host.ExecutingObject.Cloth
MeshRenderer只读
Returns a MeshRenderer component attached to this object, or nil if none exists
示例
MeshRenderer = Space.Host.ExecutingObject.MeshRenderer
Furniture只读
Returns a Furniture component attached to this object, or nil if none exists
示例
Furniture = Space.Host.ExecutingObject.Furniture
NavMeshAgent只读
Adds a NavMeshAgent component to the object.
示例
navMeshAgent = Space.Host.ExecutingObject.AddNavMeshAgent()
NavMeshObstacle只读
Returns a NavMeshObstacle component attached to this object, or nil if none exists
示例
NavMeshObstacle = Space.Host.ExecutingObject.NavMeshObstacle
ParticleSystem只读
Returns a ParticleSystem component attached to this object, or nil if none exists
示例
ParticleSystem = Space.Host.ExecutingObject.ParticleSystem
RectTransform只读
Returns a RectTransform component attached to this object, or nil if none exists
示例
RectTransform = Space.Host.ExecutingObject.RectTransform
Seat只读
Returns a reference to a Seat component on the object. Will return null if it does not exist.
示例
seatComponent = Space.Host.ExecutingObject.AddSeat()
SkinnedMeshRenderer只读
Returns a SkinnedMeshRenderer component attached to this object, or nil if none exists
示例
SkinnedMeshRenderer = Space.Host.ExecutingObject.SkinnedMeshRenderer
Radio只读
Returns a SceneBackgroundMusic component attached to this object, or nil if none exists
示例
Radio = Space.Host.ExecutingObject.Radio
Terrain只读
Returns a Terrain component attached to this object, or nil if none exists
示例
Terrain = Space.Host.ExecutingObject.Terrain
AnalyticsEvent只读
示例
analyticsEvent = Space.Host.ExecutingObject.AnalyticsEvent
GraphicRaycaster只读
示例
graphicRaycaster = Space.Host.ExecutingObject.GraphicRaycaster
ContentSizeFitter只读
示例
contentSzeFitter = Space.Host.ExecutingObject.ContentSizeFitter
Active
Is this object Active in the scene
示例
Space.Host.ExecutingObject.Active = false
--the below script will make this object become inactive
--after being being clicked
--(Example: picking up fruits)
thisGameObject = Space.Host.ExecutingObject
OnClick = function()
thisGameObject.Active = false
end
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip="Pick me!"
thisGameObject.Clickable.OnClick(OnClick)
ActiveSelf
Returns true if GameObject is Active (even if it's parent is not active)
示例
Space.Host.ExecutingObject.ActiveSelf = false
Layer
Gets/Sets the object onto a particular layer (0-31)
示例
Space.Host.ExecutingObject.Layer = 21
Tag只读
Gets this objects Tag
示例
objectTag = Space.Host.ExecutingObject.Tag
Name
Gets/sets the name of this object
示例
Space.Host.ExecutingObject.Name = 'Hello World!'
Moniker
示例
Space.Host.ExecutingObject.Moniker = 'New Moniker'
Parent
Gets/sets the parent GameObject of this object. Assign nil/null to set this as the root.
示例
Space.Host.ExecutingObject.Parent = Space.Host.GetReference("TheOtherObject")
Root只读
Gets the root of this object group - may be this object.
示例
objectRoot = Space.Host.ExecutingObject.Root
Children只读
Returns the list of direct children of this object.
示例
tableChildren = Space.Host.ExecutingObject.Children
WorldPosition
Gets or sets the current position of this object relative to the scene
示例
Space.Host.ExecutingObject.WorldPosition = Vector.New(1,1,1)
LocalPosition
Gets or sets the current position of this object relative to the objects parent, taking into account local position/scale/rotation
示例
Space.Host.ExecutingObject.LocalPosition = Vector.New(1,1,1)
WorldRotation
Gets or sets the current rotation of this object relative to the scene
示例
Space.Host.ExecutingObject.WorldRotation = Quaternion.Euler(0,180,0)
LocalRotation
Gets or sets the current rotation of this object relative to the parent object
示例
Space.Host.ExecutingObject.LocalRotation = Quaternion.Euler(0,180,0)
LocalScale
Gets or sets the current scale of this object relative to the parent
示例
Space.Host.ExecutingObject.LocalScale = Vector.New(2,2,2)
WorldScale只读
Gets the current scale of this object relative to the scene
示例
worldScale = Space.Host.ExecutingObject.WorldScale
Forward只读
Returns the forward direction vector of this game object (blue arrow)
示例
vectorForward = Space.Host.ExecutingObject.Forward
Up只读
Returns the up direction vector of this game object (green arrow)
示例
vectorUp = Space.Host.ExecutingObject.Up
Right只读
Returns the right direction vector of this game object (red arrow)
示例
vectorRight = Space.Host.ExecutingObject.Right
EventCalendar只读
Returns an EventCalendar component attached to this object, or nil if none exists
示例
EventCalendar = Space.Host.ExecutingObject.EventCalendar



