Class ValueList<T>
An abstract generic RuntimeList which encapsulates a given value type. Inherit from this class to create your own ValueList sub class. Give your class the CreateAssetMenu attribute to serialize an instance of it. A default list can be optionally set in the inspector.
Implements
Inherited Members
Namespace: ScriptableFramework
Assembly: cs.temp.dll.dll
Syntax
public abstract class ValueList<T> : RuntimeList<T>, IList<T>, IValueContainer where T : struct
Type Parameters
Name | Description |
---|---|
T | This list will be constrained to |
Fields
customDefaultValues
A default set of values for this object to initialise to if, in the inspector,
UseCustomDefault
was set to true.
Declaration
public List<T> customDefaultValues
Field Value
Type | Description |
---|---|
List<T> |
useCustomDefault
If true, the items
property will initialise to the user defined default values.
Declaration
protected bool useCustomDefault
Field Value
Type | Description |
---|---|
System.Boolean |
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()
Empties the current internal list.
Declaration
public override void Clear()
Overrides
Initialise(Int32)
Shorthand for calling Clear ()
and then adding a number of default objects.
Declaration
public override void Initialise(int newCount)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | newCount | The number of default objects to add. |
Overrides
Reset()
Clears the ValueList
then, if UseCustomDefault
is true, reinitialises the list
with the contents of customDefaultValues
.
Declaration
public override void Reset()
Overrides
ToNativeArray(Allocator)
Shorthand for creating a new NativeArray
out of the current ValueList
based on a
given allocator type.
Declaration
public virtual NativeArray<T> ToNativeArray(Allocator allocator)
Parameters
Type | Name | Description |
---|---|---|
Allocator | allocator | Specifies which allocation type to use. |
Returns
Type | Description |
---|---|
NativeArray<T> | A new |