Class Spline
The Spline class is a collection of Bezier
Implements
Inherited Members
Namespace: UnityEngine .Splines
Assembly: Unity.Splines.dll
Syntax
[Serializable]
public class Spline : ISpline, IReadOnlyList<BezierKnot>, IReadOnlyCollection<BezierKnot>, IList<BezierKnot>, ICollection<BezierKnot>, IEnumerable<BezierKnot>, IEnumerable
Constructors
Spline()
Default constructor creates a spline with no knots, not closed.
Declaration
public Spline()
Spline(IEnumerable<float3>, TangentMode, bool)
Create a spline from a collection of Unity.
Declaration
public Spline(IEnumerable<float3> knotPositions, TangentMode tangentMode = TangentMode.AutoSmooth, bool closed = false)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<float3> | knotPositions | The range of knot positions to add to the spline. |
Tangent |
tangentMode | The Tangent |
bool | closed | Whether the spline is open or closed. Open splines have a start and end point and closed splines form an unbroken loop. |
Spline(IEnumerable<BezierKnot>, bool)
Create a spline from a collection of Bezier
Declaration
public Spline(IEnumerable<BezierKnot> knots, bool closed = false)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Bezier |
knots | A collection of Bezier |
bool | closed | Whether the spline is open (has a start and end point) or closed (forms an unbroken loop). |
Spline(int, bool)
Create a spline with a pre-allocated knot capacity.
Declaration
public Spline(int knotCapacity, bool closed = false)
Parameters
Type | Name | Description |
---|---|---|
int | knotCapacity | The capacity of the knot collection. |
bool | closed | Whether the spline is open (has a start and end point) or closed (forms an unbroken loop). |
Spline(Spline)
Create a copy of a spline.
Declaration
public Spline(Spline spline)
Parameters
Type | Name | Description |
---|---|---|
Spline | spline | The spline to copy in that new instance. |
Properties
Closed
Whether the spline is open (has a start and end point) or closed (forms an unbroken loop).
Declaration
public bool Closed { get; set; }
Property Value
Type | Description |
---|---|
bool |
Count
Return the number of knots.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
IsReadOnly
Returns true if this Spline is read-only, false if it is mutable.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool |
this[int]
Get or set the knot at index
.
Declaration
public BezierKnot this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index of the element to get or set. |
Property Value
Type | Description |
---|---|
Bezier |
Knots
A collection of Bezier
Declaration
public IEnumerable<BezierKnot> Knots { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<Bezier |
Methods
Add(float3, TangentMode)
Creates a Bezier
Declaration
public void Add(float3 knotPosition, TangentMode tangentMode = TangentMode.AutoSmooth)
Parameters
Type | Name | Description |
---|---|---|
float3 | knotPosition | The knot position to convert to a Bezier |
Tangent |
tangentMode | The Tangent |
Add(BezierKnot)
Adds a knot to the spline.
Declaration
public void Add(BezierKnot item)
Parameters
Type | Name | Description |
---|---|---|
Bezier |
item | The Bezier |
Add(BezierKnot, TangentMode)
Adds a knot to the spline.
Declaration
public void Add(BezierKnot item, TangentMode mode)
Parameters
Type | Name | Description |
---|---|---|
Bezier |
item | The Bezier |
Tangent |
mode | The tangent mode for this knot. |
Add(BezierKnot, TangentMode, float)
Adds a knot to the spline.
Declaration
public void Add(BezierKnot item, TangentMode mode, float tension)
Parameters
Type | Name | Description |
---|---|---|
Bezier |
item | The Bezier |
Tangent |
mode | The tangent mode for this knot. |
float | tension | The modifier value that is used to calculate the magnitude of tangents when the
Tangent |
Add(Spline)
Adds all knots from a given spline to this spline.
Declaration
public void Add(Spline spline)
Parameters
Type | Name | Description |
---|---|---|
Spline | spline | The source spline of the knots to add. |
AddRange(IEnumerable<float3>, TangentMode)
Creates Bezier
Declaration
public void AddRange(IEnumerable<float3> knotPositions, TangentMode tangentMode = TangentMode.AutoSmooth)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<float3> | knotPositions | The range of knot positions to add to the spline. |
Tangent |
tangentMode | The Tangent |
Clear()
Remove all knots from the spline.
Declaration
public void Clear()
Contains(BezierKnot)
Return true if a knot is present in the spline.
Declaration
public bool Contains(BezierKnot item)
Parameters
Type | Name | Description |
---|---|---|
Bezier |
item | The Bezier |
Returns
Type | Description |
---|---|
bool | Returns true if the knot is found, false if it is not present. |
Copy(Spline)
Copy the values from copyFrom
to this spline.
Declaration
public void Copy(Spline copyFrom)
Parameters
Type | Name | Description |
---|---|---|
Spline | copyFrom | The spline to copy property data from. |
CopyTo(BezierKnot[], int)
Copies the contents of the knot list to an array starting at an index.
Declaration
public void CopyTo(BezierKnot[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
Bezier |
array | The destination array to place the copied item in. |
int | arrayIndex | The zero-based index to copy. |
EnforceTangentModeNoNotify(int)
Ensure that a Bezier
Declaration
public void EnforceTangentModeNoNotify(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The knot index to set tangent and rotation values for. |
EnforceTangentModeNoNotify(SplineRange)
Ensure that a Bezier
Declaration
public void EnforceTangentModeNoNotify(SplineRange range)
Parameters
Type | Name | Description |
---|---|---|
Spline |
range | The Spline |
GetAutoSmoothTension(int)
Gets the tension value for the requested index.
Declaration
public float GetAutoSmoothTension(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The knot index to get a tension value for. |
Returns
Type | Description |
---|---|
float | Returns the tension value for the requested index. |
GetCurve(int)
Get a Bezier
Declaration
public BezierCurve GetCurve(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The knot index that serves as the first control point for this curve. |
Returns
Type | Description |
---|---|
Bezier |
A Bezier |
GetCurveInterpolation(int, float)
Return the normalized interpolation (t) corresponding to a distance on a Bezier
Declaration
public float GetCurveInterpolation(int curveIndex, float curveDistance)
Parameters
Type | Name | Description |
---|---|---|
int | curveIndex | The zero-based index of the curve. |
float | curveDistance | The curve-relative distance to convert to an interpolation ratio (also referred to as 't'). |
Returns
Type | Description |
---|---|
float | The normalized interpolation ratio associated to distance on the designated curve. |
GetCurveLength(int)
Return the length of a curve.
Declaration
public float GetCurveLength(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The knot index that serves as the first control point for this curve. |
Returns
Type | Description |
---|---|
float | Returns the length of the Bezier |
See Also
GetCurveUpVector(int, float)
Return the up vector for a t ratio on the curve.
Declaration
public float3 GetCurveUpVector(int index, float t)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the curve for which the length needs to be retrieved. |
float | t | A value between 0 and 1 representing the ratio along the curve. |
Returns
Type | Description |
---|---|
float3 | Returns the up vector at the t ratio of the curve of index 'index'. |
GetEnumerator()
Get an enumerator that iterates through the Bezier
Declaration
public IEnumerator<BezierKnot> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<Bezier |
An IEnumerator that is used to iterate the Bezier |
GetFloat4DataKeys()
Get a collection of the keys of embedded Spline
Declaration
public IEnumerable<string> GetFloat4DataKeys()
Returns
Type | Description |
---|---|
IEnumerable<string> | An enumerable list of keys present for the requested type. |
GetFloat4DataValues()
Get a collection of the Spline
Declaration
public IEnumerable<SplineData<float4>> GetFloat4DataValues()
Returns
Type | Description |
---|---|
IEnumerable<Spline |
An enumerable list of values present for the requested type. |
GetFloatDataKeys()
Get a collection of the keys of embedded Spline
Declaration
public IEnumerable<string> GetFloatDataKeys()
Returns
Type | Description |
---|---|
IEnumerable<string> | An enumerable list of keys present for the requested type. |
GetFloatDataValues()
Get a collection of the Spline
Declaration
public IEnumerable<SplineData<float>> GetFloatDataValues()
Returns
Type | Description |
---|---|
IEnumerable<Spline |
An enumerable list of values present for the requested type. |
GetIntDataKeys()
Get a collection of the keys of embedded Spline
Declaration
public IEnumerable<string> GetIntDataKeys()
Returns
Type | Description |
---|---|
IEnumerable<string> | An enumerable list of keys present for the requested type. |
GetIntDataValues()
Get a collection of the Spline
Declaration
public IEnumerable<SplineData<int>> GetIntDataValues()
Returns
Type | Description |
---|---|
IEnumerable<Spline |
An enumerable list of values present for the requested type. |
GetLength()
Return the sum of all curve lengths, accounting for Closed state.
Note that this value is not accounting for transform hierarchy. If you require length in world space, use Calculate
Declaration
public float GetLength()
Returns
Type | Description |
---|---|
float | Returns the sum length of all curves composing this spline, accounting for closed state. |
Remarks
This value is cached. It is recommended to call this once in a non-performance critical path to ensure that the cache is valid.
See Also
GetObjectDataKeys()
Get a collection of the keys of embedded Spline
Declaration
public IEnumerable<string> GetObjectDataKeys()
Returns
Type | Description |
---|---|
IEnumerable<string> | An enumerable list of keys present for the requested type. |
GetObjectDataValues()
Get a collection of the Spline
Declaration
public IEnumerable<SplineData<Object>> GetObjectDataValues()
Returns
Type | Description |
---|---|
IEnumerable<Spline |
An enumerable list of values present for the requested type. |
GetOrCreateFloat4Data(string)
Returns a Splinekey
. 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 Spline
Declaration
public SplineData<float4> GetOrCreateFloat4Data(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
Spline |
A Spline |
GetOrCreateFloatData(string)
Returns a Splinekey
. 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 Spline
Declaration
public SplineData<float> GetOrCreateFloatData(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
Spline |
A Spline |
GetOrCreateIntData(string)
Returns a Splinekey
. 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 Spline
Declaration
public SplineData<int> GetOrCreateIntData(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
Spline |
A Spline |
GetOrCreateObjectData(string)
Returns a Splinekey
. 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 Spline
Declaration
public SplineData<Object> GetOrCreateObjectData(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
Spline |
A Spline |
GetSplineDataKeys(EmbeddedSplineDataType)
Get a collection of the keys of embedded Spline
Declaration
public IEnumerable<string> GetSplineDataKeys(EmbeddedSplineDataType type)
Parameters
Type | Name | Description |
---|---|---|
Embedded |
type |
Returns
Type | Description |
---|---|
IEnumerable<string> | An enumerable list of keys present for the requested type. |
GetTangentMode(int)
Gets the Tangent
Declaration
public TangentMode GetTangentMode(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index to retrieve Tangent |
Returns
Type | Description |
---|---|
Tangent |
A Tangent |
IndexOf(BezierKnot)
Return the first index of an element matching item.
Declaration
public int IndexOf(BezierKnot item)
Parameters
Type | Name | Description |
---|---|---|
Bezier |
item | The knot to locate. |
Returns
Type | Description |
---|---|
int | The zero-based index of the knot, or -1 if not found. |
Insert(int, float3, TangentMode)
Creates a Bezierindex
.
When the tangent mode is set to Mirrored, Continuous, Broken, or Linear, the final tangent values are obtained from tangents initially computed using Autosmooth to ensure accuracy.
Declaration
public void Insert(int index, float3 knotPosition, TangentMode tangentMode = TangentMode.AutoSmooth)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index to insert the new element at. |
float3 | knotPosition | The knot position to convert to a Bezier |
Tangent |
tangentMode | The Tangent |
Insert(int, BezierKnot)
Insert a Bezierindex
.
Declaration
public void Insert(int index, BezierKnot knot)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index to insert the new element. |
Bezier |
knot | The Bezier |
Insert(int, BezierKnot, TangentMode)
Inserts a Bezierindex
.
Declaration
public void Insert(int index, BezierKnot knot, TangentMode mode)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index to insert the new element. |
Bezier |
knot | The Bezier |
Tangent |
mode | The Tangent |
Insert(int, BezierKnot, TangentMode, float)
Adds a Bezierindex
.
Declaration
public void Insert(int index, BezierKnot knot, TangentMode mode, float tension)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index to insert the new element. |
Bezier |
knot | The Bezier |
Tangent |
mode | The Tangent |
float | tension | The modifier value that is used to calculate the magnitude of tangents when the
Tangent |
InsertRange(int, IEnumerable<float3>, TangentMode)
Creates Bezierindex
.
When the tangent mode is set to Mirrored, Continuous, Broken, or Linear, the final tangent values are obtained from tangents initially computed using Autosmooth to ensure accuracy.
Declaration
public void InsertRange(int index, IEnumerable<float3> knotPositions, TangentMode tangentMode = TangentMode.AutoSmooth)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index to insert the new elements at. |
IEnumerable<float3> | knotPositions | The range of knot positions to insert in the spline. |
Tangent |
tangentMode | The Tangent |
OnSplineChanged()
Invoked any time a spline property is modified.
Declaration
protected virtual void OnSplineChanged()
Remarks
In the editor this can be invoked many times per-frame. Prefer to use UnityEditor.Splines.EditorSplineUtility.AfterSplineWasModified when working with splines in the editor.
Remove(BezierKnot)
Removes the first matching knot.
Declaration
public bool Remove(BezierKnot item)
Parameters
Type | Name | Description |
---|---|---|
Bezier |
item | The Bezier |
Returns
Type | Description |
---|---|
bool | Returns true if a matching item was found and removed, false if no match was discovered. |
RemoveAt(int)
Removes the knot at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The zero-based index of the element to remove. |
RemoveFloat4Data(string)
Remove a Spline
Declaration
public bool RemoveFloat4Data(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
bool | Returns true if a matching Spline |
RemoveFloatData(string)
Remove a Spline
Declaration
public bool RemoveFloatData(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
bool | Returns true if a matching Spline |
RemoveIntData(string)
Remove a Spline
Declaration
public bool RemoveIntData(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
bool | Returns true if a matching Spline |
RemoveObjectData(string)
Remove a Spline
Declaration
public bool RemoveObjectData(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Returns
Type | Description |
---|---|
bool | Returns true if a matching Spline |
Resize(int)
Change the size of the Bezier
Declaration
public void Resize(int newSize)
Parameters
Type | Name | Description |
---|---|---|
int | newSize | The new size of the knots collection. |
SetAutoSmoothTension(int, float)
Sets the tension that is used to calculate the magnitude of tangents when the Tangent
Declaration
public void SetAutoSmoothTension(int index, float tension)
Parameters
Type | Name | Description |
---|---|---|
int | index | The knot index to set a tension value for. |
float | tension | Set the length of the tangent vectors. |
SetAutoSmoothTension(SplineRange, float)
Sets the tension that is used to calculate the magnitude of tangents when the Tangent
Declaration
public void SetAutoSmoothTension(SplineRange range, float tension)
Parameters
Type | Name | Description |
---|---|---|
Spline |
range | The range of knot indices to set a tension value for. |
float | tension | Set the length of the tangent vectors. |
SetAutoSmoothTensionNoNotify(int, float)
Sets the tension that is used to calculate the magnitude of tangents when the Tangent
Declaration
public void SetAutoSmoothTensionNoNotify(int index, float tension)
Parameters
Type | Name | Description |
---|---|---|
int | index | The knot index to set a tension value for. |
float | tension | Set the length of the tangent vectors for a knot set to Auto |
SetAutoSmoothTensionNoNotify(SplineRange, float)
Set the tension that is used to calculate the magnitude of tangents when the Tangent
Declaration
public void SetAutoSmoothTensionNoNotify(SplineRange range, float tension)
Parameters
Type | Name | Description |
---|---|---|
Spline |
range | The range of knot indices to set a tension value for. |
float | tension | Set the length of the tangent vectors for a knot set to Auto |
SetFloat4Data(string, SplineData<float4>)
Set the Splinekey
.
Declaration
public void SetFloat4Data(string key, SplineData<float4> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
value | The Spline |
SetFloatData(string, SplineData<float>)
Set the Splinekey
.
Declaration
public void SetFloatData(string key, SplineData<float> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
value | The Spline |
SetIntData(string, SplineData<int>)
Set the Splinekey
.
Declaration
public void SetIntData(string key, SplineData<int> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
value | The Spline |
SetKnot(int, BezierKnot, BezierTangent)
Sets the value of a knot at index.
Declaration
public void SetKnot(int index, BezierKnot value, BezierTangent main = BezierTangent.Out)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the Bezier |
Bezier |
value | The Bezier |
Bezier |
main | The tangent to prioritize if the tangents are modified to conform with the
Tangent |
SetKnotNoNotify(int, BezierKnot, BezierTangent)
Sets the value of a knot index without invoking any change callbacks.
Declaration
public void SetKnotNoNotify(int index, BezierKnot value, BezierTangent main = BezierTangent.Out)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the Bezier |
Bezier |
value | The Bezier |
Bezier |
main | The tangent to prioritize if the tangents are modified to conform with the
Tangent |
SetObjectData(string, SplineData<Object>)
Set the Splinekey
.
Declaration
public void SetObjectData(string key, SplineData<Object> value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
value | The Spline |
SetTangentMode(int, TangentMode, BezierTangent)
Sets the Tangent
Declaration
public void SetTangentMode(int index, TangentMode mode, BezierTangent main = BezierTangent.Out)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the knot to set. |
Tangent |
mode | The mode to set. |
Bezier |
main | The tangent direction to align both the In and Out tangent when assigning Continuous or Mirrored tangent mode. |
SetTangentMode(SplineRange, TangentMode, BezierTangent)
Sets the Tangent
Declaration
public void SetTangentMode(SplineRange range, TangentMode mode, BezierTangent main = BezierTangent.Out)
Parameters
Type | Name | Description |
---|---|---|
Spline |
range | The range of knot indices to set. |
Tangent |
mode | The mode to set. |
Bezier |
main | The tangent direction to align both the In and Out tangent with when Continuous or Mirrored tangent mode is assigned . |
SetTangentMode(TangentMode)
Sets the Tangent
Declaration
public void SetTangentMode(TangentMode mode)
Parameters
Type | Name | Description |
---|---|---|
Tangent |
mode | The Tangent |
SetTangentModeNoNotify(int, TangentMode, BezierTangent)
Sets the Tangent
Declaration
public void SetTangentModeNoNotify(int index, TangentMode mode, BezierTangent main = BezierTangent.Out)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the knot to set. |
Tangent |
mode | The mode to set. |
Bezier |
main | The tangent direction to align both the In and Out tangent when assigning Continuous or Mirrored tangent mode. |
ToArray()
Create an array of spline knots.
Declaration
public BezierKnot[] ToArray()
Returns
Type | Description |
---|---|
Bezier |
Return a new array copy of the knots collection. |
TryGetFloat4Data(string, out SplineData<float4>)
Retrieve a Splinekey
if it exists.
Note that this is a reference to the stored Spline
Declaration
public bool TryGetFloat4Data(string key, out SplineData<float4> data)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
data | The output Spline |
Returns
Type | Description |
---|---|
bool | True if the key and type combination are found, otherwise false. |
TryGetFloatData(string, out SplineData<float>)
Retrieve a Splinekey
if it exists.
Note that this is a reference to the stored Spline
Declaration
public bool TryGetFloatData(string key, out SplineData<float> data)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
data | The output Spline |
Returns
Type | Description |
---|---|
bool | True if the key and type combination are found, otherwise false. |
TryGetIntData(string, out SplineData<int>)
Retrieve a Splinekey
if it exists.
Note that this is a reference to the stored Spline
Declaration
public bool TryGetIntData(string key, out SplineData<int> data)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
data | The output Spline |
Returns
Type | Description |
---|---|
bool | True if the key and type combination are found, otherwise false. |
TryGetObjectData(string, out SplineData<Object>)
Retrieve a Splinekey
if it exists.
Note that this is a reference to the stored Spline
Declaration
public bool TryGetObjectData(string key, out SplineData<Object> data)
Parameters
Type | Name | Description |
---|---|---|
string | key | The string key value to search for. Only one instance of a key value can exist in an
embedded Spline |
Spline |
data | The output Spline |
Returns
Type | Description |
---|---|
bool | True if the key and type combination are found, otherwise false. |
Warmup()
Ensure that all caches contain valid data. Call this to avoid unexpected performance costs when accessing spline data. Caches remain valid until any part of the spline state is modified.
Declaration
public void Warmup()
Events
Changed
Invoked any time a spline is modified.
Declaration
public static event Action<Spline, int, SplineModification> Changed
Event Type
Type | Description |
---|---|
Action<Spline, int, Spline |
Remarks
First parameter is the target Spline that the event is raised for, second parameter is the knot index and the third parameter represents the type of change that occurred. If the event does not target a specific knot, the second parameter will have the value of -1.
In the editor this callback can be invoked many times per-frame. Prefer to use UnityEditor.Splines.EditorSplineUtility.AfterSplineWasModified when working with splines in the editor.