docs.unity3d.com
    Show / Hide Table of Contents

    Class SplineContainer

    A Component that holds a Spline object.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    SplineContainer
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, Boolean)
    Component.GetComponentInParent(Type)
    UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    Object.FindObjectOfType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.ToString()
    Object.name
    Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Splines
    Syntax
    [AddComponentMenu("Splines/Spline")]
    [ExecuteInEditMode]
    public sealed class SplineContainer : MonoBehaviour, ISplineContainer, ISerializationCallbackReceiver

    Properties

    KnotLinkCollection

    A collection of all linked knots. Linked knots can be on different splines. However, knots can only link to other knots within the same container. This collection is used to maintain the validity of the links when operations such as knot insertions or removals are performed on the splines.

    Declaration
    public KnotLinkCollection KnotLinkCollection { get; }
    Property Value
    Type Description
    KnotLinkCollection
    Implements
    ISplineContainer.KnotLinkCollection

    Spline

    The main Spline attached to this component.

    Declaration
    public Spline Spline { get; set; }
    Property Value
    Type Description
    Spline

    Splines

    The list of all splines attached to that container.

    Declaration
    public IReadOnlyList<Spline> Splines { get; set; }
    Property Value
    Type Description
    IReadOnlyList<Spline>
    Implements
    ISplineContainer.Splines

    Methods

    CalculateLength()

    Calculate the length of Spline in world space.

    Declaration
    public float CalculateLength()
    Returns
    Type Description
    Single

    The length of Spline in world space

    CalculateLength(Int32)

    Calculates the length of Splines[splineIndex] in world space.

    Declaration
    public float CalculateLength(int splineIndex)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline to evaluate.

    Returns
    Type Description
    Single

    The length of Splines[splineIndex] in world space

    Evaluate(Int32, Single, out float3, out float3, out float3)

    Computes the interpolated position, direction and upDirection at ratio t for the spline at index splineIndex. Calling this method to get the 3 vectors is faster than calling independently EvaluateSplinePosition, EvaluateSplineTangent and EvaluateSplineUpVector for the same time t as it reduces some redundant computation.

    Declaration
    public bool Evaluate(int splineIndex, float t, out float3 position, out float3 tangent, out float3 upVector)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline to evaluate.

    Single t

    A value between 0 and 1 that represents the ratio along the curve.

    float3 position

    The output variable for the float3 position at t.

    float3 tangent

    The output variable for the float3 tangent at t.

    float3 upVector

    The output variable for the float3 up direction at t.

    Returns
    Type Description
    Boolean

    True if a valid set of output variables is computed and false otherwise.

    Evaluate(Single, out float3, out float3, out float3)

    Computes interpolated position, direction and upDirection at ratio t. Calling this method to get the 3 vectors is faster than calling independently EvaluateSplinePosition, EvaluateSplineTangent and EvaluateSplineUpVector for the same time t as it reduces some redundant computation.

    Declaration
    public bool Evaluate(float t, out float3 position, out float3 tangent, out float3 upVector)
    Parameters
    Type Name Description
    Single t

    A value between 0 and 1 representing the ratio along the curve.

    float3 position

    The output variable for the float3 position at t.

    float3 tangent

    The output variable for the float3 tangent at t.

    float3 upVector

    The output variable for the float3 up direction at t.

    Returns
    Type Description
    Boolean

    Boolean value, true if a valid set of output variables as been computed.

    Evaluate<T>(T, Single, out float3, out float3, out float3)

    Gets the interpolated position, direction, and upDirection at ratio t for a spline. This method gets the three
    vectors faster than EvaluateSplinePosition, EvaluateSplineTangent and EvaluateSplineUpVector for the same time t, because it reduces some redundant computation.

    Declaration
    public bool Evaluate<T>(T spline, float t, out float3 position, out float3 tangent, out float3 upVector)
        where T : ISpline
    Parameters
    Type Name Description
    T spline

    The spline to evaluate.

    Single t

    A value between 0 and 1 that represents the ratio along the curve.

    float3 position

    The output variable for the float3 position at t.

    float3 tangent

    The output variable for the float3 tangent at t.

    float3 upVector

    The output variable for the float3 up direction at t.

    Returns
    Type Description
    Boolean

    True if a valid set of output variables is computed and false otherwise.

    Type Parameters
    Name Description
    T

    EvaluateAcceleration(Int32, Single)

    Evaluates the acceleration vector of a point, t, on a spline at an index, `splineIndex, in world space.

    Declaration
    public float3 EvaluateAcceleration(int splineIndex, float t)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline to evaluate.

    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed acceleration vector.

    EvaluateAcceleration(Single)

    Evaluates the acceleration vector of a point, t, on a spline in world space.

    Declaration
    public float3 EvaluateAcceleration(float t)
    Parameters
    Type Name Description
    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed acceleration vector.

    EvaluateAcceleration<T>(T, Single)

    Declaration
    public float3 EvaluateAcceleration<T>(T spline, float t)
        where T : ISpline
    Parameters
    Type Name Description
    T spline
    Single t
    Returns
    Type Description
    float3
    Type Parameters
    Name Description
    T

    EvaluatePosition(Int32, Single)

    Evaluates the position of a point, t, on a spline at an index, splineIndex, in world space.

    Declaration
    public float3 EvaluatePosition(int splineIndex, float t)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline to evaluate.

    Single t

    A value between 0 and 1 representing a percentage of the curve.

    Returns
    Type Description
    float3

    A world position along the spline.

    EvaluatePosition(Single)

    valuates the position of a point, t, on a spline in world space.

    Declaration
    public float3 EvaluatePosition(float t)
    Parameters
    Type Name Description
    Single t

    A value between 0 and 1 representing a percentage of the curve.

    Returns
    Type Description
    float3

    A tangent vector.

    EvaluatePosition<T>(T, Single)

    Evaluates the position of a point, t, on a given spline, in world space.

    Declaration
    public float3 EvaluatePosition<T>(T spline, float t)
        where T : ISpline
    Parameters
    Type Name Description
    T spline

    The spline to evaluate.

    Single t

    A value between 0 and 1 representing a percentage of the curve.

    Returns
    Type Description
    float3

    A world position along the spline.

    Type Parameters
    Name Description
    T

    EvaluateTangent(Int32, Single)

    Evaluates the tangent vector of a point, t, on a spline at an index, splineIndex, in world space.

    Declaration
    public float3 EvaluateTangent(int splineIndex, float t)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline to evaluate.

    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed tangent vector.

    EvaluateTangent(Single)

    Evaluates the tangent vector of a point, t, on a spline in world space.

    Declaration
    public float3 EvaluateTangent(float t)
    Parameters
    Type Name Description
    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed tangent vector.

    EvaluateTangent<T>(T, Single)

    Evaluates the tangent vector of a point, t, on a given spline, in world space.

    Declaration
    public float3 EvaluateTangent<T>(T spline, float t)
        where T : ISpline
    Parameters
    Type Name Description
    T spline

    The spline to evaluate.

    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed tangent vector.

    Type Parameters
    Name Description
    T

    EvaluateUpVector(Int32, Single)

    Evaluates the up vector of a point, t, on a spline at an index, splineIndex, in world space.

    Declaration
    public float3 EvaluateUpVector(int splineIndex, float t)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the Spline to evaluate.

    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed up direction.

    EvaluateUpVector(Single)

    Evaluates the up vector of a point, t, on a spline in world space.

    Declaration
    public float3 EvaluateUpVector(float t)
    Parameters
    Type Name Description
    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed up direction.

    EvaluateUpVector<T>(T, Single)

    Evaluates the up vector of a point, t, on a given spline, in world space.

    Declaration
    public float3 EvaluateUpVector<T>(T spline, float t)
        where T : ISpline
    Parameters
    Type Name Description
    T spline

    The Spline to evaluate.

    Single t

    A value between 0 and 1 representing a percentage of entire spline.

    Returns
    Type Description
    float3

    The computed up direction.

    Type Parameters
    Name Description
    T

    OnAfterDeserialize()

    See ISerializationCallbackReceiver.

    Declaration
    public void OnAfterDeserialize()
    Implements
    ISerializationCallbackReceiver.OnAfterDeserialize()

    OnBeforeSerialize()

    See ISerializationCallbackReceiver.

    Declaration
    public void OnBeforeSerialize()
    Implements
    ISerializationCallbackReceiver.OnBeforeSerialize()

    Extension Methods

    SplineUtility.AddSpline<T>(T)
    SplineUtility.RemoveSplineAt<T>(T, Int32)
    SplineUtility.RemoveSpline<T>(T, Spline)
    SplineUtility.SetLinkedKnotPosition<T>(T, SplineKnotIndex)
    SplineUtility.LinkKnots<T>(T, SplineKnotIndex, SplineKnotIndex)
    SplineUtility.UnlinkKnots<T>(T, IReadOnlyList<SplineKnotIndex>)
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023