Class Spline
Spline contains control points used to define curve/outline for generating SpriteShape geometry.
Namespace: UnityEngine.U2D
Syntax
[Serializable]
public class Spline
Properties
isOpenEnded
Get/Set Spline's shape to open ended or closed.
Declaration
public bool isOpenEnded { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
Clear()
Clear all control points.
Declaration
public void Clear()
GetCorner(Int32)
Test if a corner mode is enabled at control point.
Declaration
public bool GetCorner(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Returns
Type | Description |
---|---|
Boolean | True if a valid corner mode is set. |
GetHashCode()
Get hash code for this Spline to test for changes.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | Hash code as int. |
Overrides
GetHeight(Int32)
Get height of control point at index.
Declaration
public float GetHeight(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Returns
Type | Description |
---|---|
Single | Height. |
GetLeftTangent(Int32)
Get left tangent of control point at index.
Declaration
public Vector3 GetLeftTangent(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Returns
Type | Description |
---|---|
Vector3 | Left tangent of control point. |
GetPointCount()
Get Spline's control point count.
Declaration
public int GetPointCount()
Returns
Type | Description |
---|---|
Int32 | Count of control points. |
GetPosition(Int32)
Get position of control point at index.
Declaration
public Vector3 GetPosition(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Returns
Type | Description |
---|---|
Vector3 |
GetRightTangent(Int32)
Get right tangent of control point at index,
Declaration
public Vector3 GetRightTangent(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Returns
Type | Description |
---|---|
Vector3 | Right tangent of control point. |
GetSpriteIndex(Int32)
Get Sprite index to be used for rendering edge starting at control point.
Declaration
public int GetSpriteIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Returns
Type | Description |
---|---|
Int32 | Sprite index. |
GetTangentMode(Int32)
Get tangent mode of control point at index.
Declaration
public ShapeTangentMode GetTangentMode(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Returns
Type | Description |
---|---|
ShapeTangentMode | Tangent mode of control point |
InsertPointAt(Int32, Vector3)
Insert control point at index.
Declaration
public void InsertPointAt(int index, Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index at which a control point will be inserted. |
Vector3 | point | Position of the control point. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
RemovePointAt(Int32)
Remove a control point from the Spline at index.
Declaration
public void RemovePointAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of the control point to be removed. |
SetCorner(Int32, Boolean)
Set corner mode to automatic or disabled.
Declaration
public void SetCorner(int index, bool value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Boolean | value | Enable/disable corner mode |
SetHeight(Int32, Single)
Set height of control point at index.
Declaration
public void SetHeight(int index, float value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Single | value | Height. |
SetLeftTangent(Int32, Vector3)
Set left tangent of control point at index.
Declaration
public void SetLeftTangent(int index, Vector3 tangent)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Vector3 | tangent | Left tangent of control point. |
SetPosition(Int32, Vector3)
Set position of control point at index.
Declaration
public void SetPosition(int index, Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Vector3 | point | Position of control point. |
Exceptions
Type | Condition |
---|---|
ArgumentException |
SetRightTangent(Int32, Vector3)
Set right tangent of control point at index.
Declaration
public void SetRightTangent(int index, Vector3 tangent)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Vector3 | tangent | Right tangent of control point. |
SetSpriteIndex(Int32, Int32)
Set Sprite index to be used for rendering edge starting at control point.
Declaration
public void SetSpriteIndex(int index, int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
Int32 | value | Sprite index. |
SetTangentMode(Int32, ShapeTangentMode)
Set the tangent mode of control point at index.
Declaration
public void SetTangentMode(int index, ShapeTangentMode mode)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index of control point. |
ShapeTangentMode | mode | Tangent mode. |