SScriptingData
客户端组件
在此类中GetVariable
成员 6
| 函数 | GetVariable | Return the object of the variable. |
| 函数 | SetVariable | Set properties to variable. |
| 属性 | Enabled | Is the ScriptingData component Enabled? |
| 属性 | Variables | – |
| 属性 | ComponentName | The name of this component. |
| 属性 | GameObject | – |
函数
GetVariable
object GetVariable(string name)
Return the object of the variable.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
返回值
object
示例
Lua
Space.Host.ExecutingObject.Data.GetVariable("variableName")
SetVariable
void SetVariable(string name, DynValue property, bool persistent = false)
Set properties to variable.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| name | string | – |
| property | DynValue | – |
| persistent | bool | false |
返回值
void
示例
Lua
Space.Host.ExecutingObject.SetVariable("variableName",5,true)
属性
Enabled
bool Enabled {get; set; }
Is the ScriptingData component Enabled?
示例
Lua
Space.Host.ExecutingObject.Data.Enabled = false
Lua
--clicking this object will Enable/Disable it's Scripting Data component
thisGameObject = Space.Host.ExecutingObject
component = thisGameObject.Data
OnClick = function()
component.Enabled = not component.Enabled
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
Variables只读
string[] Variables {get; }
示例
Lua
variableNames = Space.Host.ExecutingObject.Data.Variables
ComponentName只读
string ComponentName {get; }
The name of this component.
示例
Lua
componentName = Space.Host.ExecutingObject.Data.ComponentName
GameObject只读
示例
Lua
theGameObject = Space.Host.ExecutingObject.Data.GameObject



