Class DatumProperty<TValue, TDatum>
Class used as a serialized field in a component for containing a typed value that is either directly serialized as a constant value or a reference to a ScriptableObject container for that data.
Inherited Members
Namespace: Unity.XR.CoreUtils.Datums
Syntax
[Serializable]
public abstract class DatumProperty<TValue, TDatum>
where TDatum : Datum<TValue>
Type Parameters
| Name | Description |
|---|---|
| TValue | Value type. |
| TDatum | Datum asset type. |
Constructors
DatumProperty()
Default constructor which creates an empty datum asset reference.
Declaration
protected DatumProperty()
DatumProperty(TValue)
Constructor setting initial value for the embedded constant.
Declaration
protected DatumProperty(TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TValue | value | Initial value. |
DatumProperty(TDatum)
Constructor setting initial datum asset reference.
Declaration
protected DatumProperty(TDatum datum)
Parameters
| Type | Name | Description |
|---|---|---|
| TDatum | datum | Datum asset reference. |
Properties
ConstantValue
The current constant value used when this property is set to "Use Value".
Declaration
protected TValue ConstantValue { get; }
Property Value
| Type | Description |
|---|---|
| TValue |
Datum
The current datum asset reference used when this property is set to "Use Asset".
Declaration
protected Datum<TValue> Datum { get; }
Property Value
| Type | Description |
|---|---|
| Datum<TValue> |
Value
Accessor for internal value held by this container. Getter/Setter uses the constant value if this property is set to "Use Value" and the associated datum's value is referenced if this property is set to "Use Asset".
Declaration
public TValue Value { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
Operators
Implicit(DatumProperty<TValue, TDatum> to TValue)
Operator making it easy to treat the container property as the underlying internal value.
Declaration
public static implicit operator TValue(DatumProperty<TValue, TDatum> datumProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| DatumProperty<TValue, TDatum> | datumProperty | Property to get the internal value of. |
Returns
| Type | Description |
|---|---|
| TValue | Returns internal value represented by the property. |