Class Spline
Spline contains control points used to define curve/outline for generating SpriteShape geometry.
Inherited Members
Namespace: UnityEngine .U2D
Assembly: Unity.2D.SpriteShape.Runtime.dll
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 |
---|---|
bool |
Methods
Clear()
Clear all control points.
Declaration
public void Clear()
GetCorner(int)
Test if a corner mode is enabled at control point.
Declaration
public bool GetCorner(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Returns
Type | Description |
---|---|
bool | 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 |
---|---|
int | Hash code as int. |
Overrides
GetHeight(int)
Get height of control point at index.
Declaration
public float GetHeight(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Returns
Type | Description |
---|---|
float | Height. |
GetLeftTangent(int)
Get left tangent of control point at index.
Declaration
public Vector3 GetLeftTangent(int index)
Parameters
Type | Name | Description |
---|---|---|
int | 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 |
---|---|
int | Count of control points. |
GetPosition(int)
Get position of control point at index.
Declaration
public Vector3 GetPosition(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Returns
Type | Description |
---|---|
Vector3 | Position at the specifiedx Index. |
GetRightTangent(int)
Get right tangent of control point at index,
Declaration
public Vector3 GetRightTangent(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Returns
Type | Description |
---|---|
Vector3 | Right tangent of control point. |
GetSpriteIndex(int)
Get Sprite index to be used for rendering edge starting at control point.
Declaration
public int GetSpriteIndex(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Returns
Type | Description |
---|---|
int | Sprite index. |
GetTangentMode(int)
Get tangent mode of control point at index.
Declaration
public ShapeTangentMode GetTangentMode(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Returns
Type | Description |
---|---|
Shape |
Tangent mode of control point |
InsertPointAt(int, Vector3)
Insert control point at index.
Declaration
public void InsertPointAt(int index, Vector3 point)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index at which a control point will be inserted. |
Vector3 | point | Position of the control point. |
Exceptions
Type | Condition |
---|---|
Argument |
Index is not valid. |
RemovePointAt(int)
Remove a control point from the Spline at index.
Declaration
public void RemovePointAt(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of the control point to be removed. |
SetCorner(int, bool)
Set corner mode to automatic or disabled.
Declaration
public void SetCorner(int index, bool value)
Parameters
SetHeight(int, float)
Set height of control point at index.
Declaration
public void SetHeight(int index, float value)
Parameters
SetLeftTangent(int, Vector3)
Set left tangent of control point at index.
Declaration
public void SetLeftTangent(int index, Vector3 tangent)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Vector3 | tangent | Left tangent of control point. |
SetPosition(int, Vector3)
Set position of control point at index.
Declaration
public void SetPosition(int index, Vector3 point)
Parameters
Exceptions
Type | Condition |
---|---|
Argument |
Index is not valid. |
SetRightTangent(int, Vector3)
Set right tangent of control point at index.
Declaration
public void SetRightTangent(int index, Vector3 tangent)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Vector3 | tangent | Right tangent of control point. |
SetSpriteIndex(int, int)
Set Sprite index to be used for rendering edge starting at control point.
Declaration
public void SetSpriteIndex(int index, int value)
Parameters
SetTangentMode(int, ShapeTangentMode)
Set the tangent mode of control point at index.
Declaration
public void SetTangentMode(int index, ShapeTangentMode mode)
Parameters
Type | Name | Description |
---|---|---|
int | index | Index of control point. |
Shape |
mode | Tangent mode. |