Breakroom is now Sinewave Campus. Book a meeting

SScriptingData

客户端组件
在此类中GetVariable
  1. 函数
  2. GetVariable
  3. SetVariable
  4. 属性
  5. Enabled
  6. Variables
  7. ComponentName
  8. GameObject
成员 6
函数GetVariableReturn the object of the variable.
函数SetVariableSet properties to variable.
属性EnabledIs the ScriptingData component Enabled?
属性Variables–
属性ComponentNameThe name of this component.
属性GameObject–

函数​

GetVariable​

object GetVariable(string name)

Return the object of the variable.

参数

名称类型默认值
namestring–

返回值

object

示例

Lua
Space.Host.ExecutingObject.Data.GetVariable("variableName")

SetVariable​

void SetVariable(string name, DynValue property, bool persistent = false)

Set properties to variable.

参数

名称类型默认值
namestring–
propertyDynValue–
persistentboolfalse

返回值

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只读​

SGameObject GameObject {get; }

示例

Lua
theGameObject = Space.Host.ExecutingObject.Data.GameObject