Class ValueItem<T>
An abstract generic RuntimeObject which encapsulates a given value type. Inherit from this class to create your own RuntimeValue sub class. Give your class the CreateAssetMenu attribute to serialize an instance of it. A default value can be optionally set in the inspector.
Implements
Namespace: ScriptableFramework
Assembly: cs.temp.dll.dll
Syntax
public abstract class ValueItem<T> : RuntimeItem<T>, IValueContainer where T : struct
Type Parameters
| Name | Description |
|---|---|
| T | A |
Fields
customDefaultValue
A default value for this object to initialise to if, in the inspector,
UseCustomDefault was set to true.
Declaration
public T customDefaultValue
Field Value
| Type | Description |
|---|---|
| T |
useCustomDefault
If true, the value property will initialise to the user defined default value.
Declaration
protected bool useCustomDefault
Field Value
| Type | Description |
|---|---|
| System.Boolean |
value
The value type object being stored.
Declaration
public T value
Field Value
| Type | Description |
|---|---|
| T |
Properties
UseCustomDefault
Toggle this on to ensure that the object resets with user defined custom default value(s).
Declaration
public bool UseCustomDefault { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Methods
Clear()
Call the constructor of T and set value as the result.
Declaration
public override void Clear()
Overrides
Reset()
If UseCustomDefault was set to true, the value property will be set to
the user defined default. Otherwise, this will simply call Clear ().
Declaration
public override void Reset()
Overrides
UpdateValue(T)
Included for ValueItems to be set via UI events.
Declaration
public void UpdateValue(T newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| T | newValue | The new value passed from the UI event. |