docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Spline

    Spline contains control points used to define curve/outline for generating SpriteShape geometry.

    Inheritance
    object
    Spline
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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
    object.GetHashCode()

    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
    ShapeTangentMode

    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
    ArgumentException

    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
    Type Name Description
    int index

    Index of control point.

    bool value

    Enable/disable corner mode

    SetHeight(int, float)

    Set height of control point at index.

    Declaration
    public void SetHeight(int index, float value)
    Parameters
    Type Name Description
    int index

    Index of control point.

    float value

    Height.

    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
    Type Name Description
    int index

    Index of control point.

    Vector3 point

    Position of control point.

    Exceptions
    Type Condition
    ArgumentException

    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
    Type Name Description
    int index

    Index of control point.

    int value

    Sprite index.

    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.

    ShapeTangentMode mode

    Tangent mode.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)