Class VariablesMapper
Use this class to map existing variables to multiple variables under a common path prefix.
Intended for expanding list / dictionary variables.
For example a VariablesMapper could expand a json variable to multiple varialbes:
source variable => items-list: ["item1", "item2", "item3"]
mapped variables => items-list-1: "item1"
items-list-2: "item2"
items-list-3: "item3"
Inheritance
VariablesMapper
Assembly: NoSuchStudio-Variables.dll
Syntax
[ExecuteAlways]
public abstract class VariablesMapper : NoSuchMonoBehaviour, IVariableSource, IVariablesServiceComponent, IServiceComponent<VariablesService>
Fields
_connected
Declaration
[NonSerialized]
protected Dictionary<Type, bool> _connected
Field Value
_mappedPrefix
Declaration
[SerializeField]
protected string _mappedPrefix
Field Value
_mappedVariables
Declaration
[NonSerialized]
protected Dictionary<string, string> _mappedVariables
Field Value
_readyToConnect
Declaration
[NonSerialized]
protected bool _readyToConnect
Field Value
_sourceVariable
Declaration
[SerializeField]
protected string _sourceVariable
Field Value
Properties
mappedVariables
Declaration
public Dictionary<string, string> mappedVariables { get; }
Property Value
mono
Declaration
public MonoBehaviour mono { get; }
Property Value
| Type |
Description |
| UnityEngine.MonoBehaviour |
|
sourceVariable
Declaration
public string sourceVariable { get; set; }
Property Value
Methods
Connect<ST>()
Declaration
public void Connect<ST>()
where ST : Service<ST>
Type Parameters
CreateMappedVariables()
Declaration
protected abstract Dictionary<string, string> CreateMappedVariables()
Returns
CreateSourceValue()
Declaration
protected abstract string CreateSourceValue()
Returns
Disconnect<ST>()
Declaration
public void Disconnect<ST>()
where ST : Service<ST>
Type Parameters
GetVariable(String)
Declaration
public string GetVariable(string variable)
Parameters
| Type |
Name |
Description |
| String |
variable |
|
Returns
IsConnected<ST>()
Declaration
public bool IsConnected<ST>()
where ST : Service<ST>
Returns
Type Parameters
OnDisable()
Declaration
protected virtual void OnDisable()
OnEnable()
Declaration
protected virtual void OnEnable()
SetVariable(String, String)
Declaration
public bool SetVariable(string variable, string value)
Parameters
Returns
Implements
IServiceComponent<>