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
Assembly: Unity.Splines.dll
Syntax
[Serializable]
public class EmbeddedSplineData
Constructors
EmbeddedSplineData()
Create a new EmbeddedSplineData instance with no parameters.
Declaration
public EmbeddedSplineData()
See Also
EmbeddedSplineData(string, EmbeddedSplineDataType, SplineContainer, int)
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. |
int | splineIndex | The index of the Spline on the SplineContainer. |
See Also
Properties
Container
The SplineContainer that holds the Spline.
Declaration
public SplineContainer Container { get; set; }
Property Value
Type | Description |
---|---|
SplineContainer |
See Also
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 |
See Also
SplineIndex
The index of the Spline on the SplineContainer.
Declaration
public int SplineIndex { get; set; }
Property Value
Type | Description |
---|---|
int |
See Also
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 |
See Also
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. |
See Also
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<float> | 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. |
See Also
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<int> | 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. |
See Also
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. |
See Also
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 | A SplineData<T> reference if the Container, SplineIndex, Key, and Type are valid, otherwise null. |
Returns
Type | Description |
---|---|
bool | 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. |
See Also
TryGetFloatData(out SplineData<float>)
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<float> | data | A SplineData<T> reference if the Container, SplineIndex, Key, and Type are valid, otherwise null. |
Returns
Type | Description |
---|---|
bool | 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. |
See Also
TryGetIntData(out SplineData<int>)
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<int> | data | A SplineData<T> reference if the Container, SplineIndex, Key, and Type are valid, otherwise null. |
Returns
Type | Description |
---|---|
bool | 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. |
See Also
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 | A SplineData<T> reference if the Container, SplineIndex, Key, and Type are valid, otherwise null. |
Returns
Type | Description |
---|---|
bool | 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. |
See Also
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 |
---|---|
bool | Returns true if the Container and SplineIndex are valid, otherwise false. |