Class EmbeddedSplineData
Wrapper for accessing a SplineData<T> value stored on Spline through one of the embedded key value collections. It is not required to use this class to access embedded SplineData<T>, however it does provide some convenient functionality for working with this data in the Inspector.
Inherited Members
Namespace: UnityEngine.Splines
Syntax
[Serializable]
public class EmbeddedSplineData
Constructors
EmbeddedSplineData()
Create a new EmbeddedSplineData instance with no parameters.
Declaration
public EmbeddedSplineData()
EmbeddedSplineData(String, EmbeddedSplineDataType, SplineContainer, Int32)
Create a new EmbeddedSplineData with parameters.
Declaration
public EmbeddedSplineData(string key, EmbeddedSplineDataType type, SplineContainer container = null, int splineIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
String | key | A unique string value used to identify and access a SplineData<T> collection stored in a Spline. |
EmbeddedSplineDataType | type | The type of data stored by the SplineData<T> collection. |
SplineContainer | container | The SplineContainer that holds the Spline. |
Int32 | splineIndex | The index of the Spline on the SplineContainer. |
Properties
Container
The SplineContainer that holds the Spline.
Declaration
public SplineContainer Container { get; set; }
Property Value
Type | Description |
---|---|
SplineContainer |
Key
A unique string value used to identify and access a SplineData<T> collection stored in a Spline.
Declaration
public string Key { get; set; }
Property Value
Type | Description |
---|---|
String |
SplineIndex
The index of the Spline on the SplineContainer.
Declaration
public int SplineIndex { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Type
The type of data stored by the SplineData<T> collection. Embedded SplineData<T> is restricted to a pre-defined set of primitive types.
Declaration
public EmbeddedSplineDataType Type { get; set; }
Property Value
Type | Description |
---|---|
EmbeddedSplineDataType |
Methods
GetOrCreateFloat4Data()
Returns a SplineData<T> for Key and Type. If an instance matching the key and type does not exist, a new entry is appended to the internal collection and returned. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data.
Declaration
public SplineData<float4> GetOrCreateFloat4Data()
Returns
Type | Description |
---|---|
SplineData<float4> | A SplineData<T> of the requested type. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
GetOrCreateFloatData()
Returns a SplineData<T> for Key and Type. If an instance matching the key and type does not exist, a new entry is appended to the internal collection and returned. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data.
Declaration
public SplineData<float> GetOrCreateFloatData()
Returns
Type | Description |
---|---|
SplineData<Single> | A SplineData<T> of the requested type. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
GetOrCreateIntData()
Returns a SplineData<T> for Key and Type. If an instance matching the key and type does not exist, a new entry is appended to the internal collection and returned. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data.
Declaration
public SplineData<int> GetOrCreateIntData()
Returns
Type | Description |
---|---|
SplineData<Int32> | A SplineData<T> of the requested type. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
GetOrCreateObjectData()
Returns a SplineData<T> for Key and Type. If an instance matching the key and type does not exist, a new entry is appended to the internal collection and returned. Note that this is a reference to the stored SplineData<T>, not a copy. Any modifications to this collection will affect the Spline data.
Declaration
public SplineData<Object> GetOrCreateObjectData()
Returns
Type | Description |
---|---|
SplineData<Object> | A SplineData<T> of the requested type. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
TryGetFloat4Data(out SplineData<float4>)
Attempt to get a reference to the SplineData<T> described by this object.
Declaration
public bool TryGetFloat4Data(out SplineData<float4> data)
Parameters
Type | Name | Description |
---|---|---|
SplineData<float4> | data |
Returns
Type | Description |
---|---|
Boolean | Returns true if a SplineData<T> value exists, otherwise false. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
TryGetFloatData(out SplineData<Single>)
Attempt to get a reference to the SplineData<T> described by this object.
Declaration
public bool TryGetFloatData(out SplineData<float> data)
Parameters
Type | Name | Description |
---|---|---|
SplineData<Single> | data | A SplineData<T> reference if the Container, SplineIndex, Key, and Type are valid, otherwise null. |
Returns
Type | Description |
---|---|
Boolean | Returns true if a SplineData<T> value exists, otherwise false. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
TryGetIntData(out SplineData<Int32>)
Attempt to get a reference to the SplineData<T> described by this object.
Declaration
public bool TryGetIntData(out SplineData<int> data)
Parameters
Type | Name | Description |
---|---|---|
SplineData<Int32> | data |
Returns
Type | Description |
---|---|
Boolean | Returns true if a SplineData<T> value exists, otherwise false. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
TryGetObjectData(out SplineData<Object>)
Attempt to get a reference to the SplineData<T> described by this object.
Declaration
public bool TryGetObjectData(out SplineData<Object> data)
Parameters
Type | Name | Description |
---|---|---|
SplineData<Object> | data |
Returns
Type | Description |
---|---|
Boolean | Returns true if a SplineData<T> value exists, otherwise false. |
Exceptions
Type | Condition |
---|---|
InvalidCastException | An exception is thrown if the requested SplineData<T> does not match the EmbeddedSplineDataType. |
TryGetSpline(out Spline)
Attempt to get a reference to the Spline described by this object.
Declaration
public bool TryGetSpline(out Spline spline)
Parameters
Type | Name | Description |
---|---|---|
Spline | spline | A Spline if the Container and SplineIndex are valid, otherwise null. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the Container and SplineIndex are valid, otherwise false. |