Breakroom is now Sinewave Campus. Book a meeting

SScriptingData

ClientComponents
On this classGetVariable
  1. Functions
  2. GetVariable
  3. SetVariable
  4. Properties
  5. Enabled
  6. Variables
  7. ComponentName
  8. GameObject
Members 6
FunctionGetVariableReturn the object of the variable.
FunctionSetVariableSet properties to variable.
PropertyEnabledIs the ScriptingData component Enabled?
PropertyVariables–
PropertyComponentNameThe name of this component.
PropertyGameObject–

Functions​

GetVariable​

object GetVariable(string name)

Return the object of the variable.

Parameters

NameTypeDefault
namestring–

Returns

object

Example

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

SetVariable​

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

Set properties to variable.

Parameters

NameTypeDefault
namestring–
propertyDynValue–
persistentboolfalse

Returns

void

Example

Lua
Space.Host.ExecutingObject.SetVariable("variableName",5,true)

Properties​

Enabled​

bool Enabled {get; set; }

Is the ScriptingData component Enabled?

Example

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)

VariablesRead only​

string[] Variables {get; }

Example

Lua
variableNames = Space.Host.ExecutingObject.Data.Variables

ComponentNameRead only​

string ComponentName {get; }

The name of this component.

Example

Lua
componentName = Space.Host.ExecutingObject.Data.ComponentName

GameObjectRead only​

SGameObject GameObject {get; }

Example

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