docs.unity3d.com
    Show / Hide Table of Contents

    Class KnotLinkCollection

    A collection of KnotLinks to track how spline knots are linked and the utilities to update these links when splines are modified.

    Inheritance
    Object
    KnotLinkCollection
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.Splines
    Syntax
    [Serializable]
    public sealed class KnotLinkCollection

    Properties

    Count

    How many KnotLinks the collection contains.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    Int32

    Methods

    Clear()

    Clears all the links in the collection.

    Declaration
    public void Clear()

    GetKnotLinks(SplineKnotIndex)

    Gets the knots linked to a specific knot.

    Declaration
    public IReadOnlyList<SplineKnotIndex> GetKnotLinks(SplineKnotIndex knotIndex)
    Parameters
    Type Name Description
    SplineKnotIndex knotIndex

    The SplineKnotIndex of the knot.

    Returns
    Type Description
    IReadOnlyList<SplineKnotIndex>

    Returns a list of knots linked to the specified knot. The specified knot is also in the list.

    KnotIndexChanged(Int32, Int32, Int32)

    Updates the KnotLinkCollection indices after a knot index changes.

    Declaration
    public void KnotIndexChanged(int splineIndex, int previousKnotIndex, int newKnotIndex)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline.

    Int32 previousKnotIndex

    The previous index of the knot in the spline.

    Int32 newKnotIndex

    The new index of the knot in the spline.

    KnotIndexChanged(SplineKnotIndex, SplineKnotIndex)

    Updates the KnotLinkCollection indices after a knot index changes.

    Declaration
    public void KnotIndexChanged(SplineKnotIndex previousIndex, SplineKnotIndex newIndex)
    Parameters
    Type Name Description
    SplineKnotIndex previousIndex

    The previous SplineKnotIndex of the knot.

    SplineKnotIndex newIndex

    The new SplineKnotIndex of the knot.

    KnotInserted(Int32, Int32)

    Updates the KnotLinkCollection indices after a knot has been inserted.

    Declaration
    public void KnotInserted(int splineIndex, int knotIndex)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline.

    Int32 knotIndex

    The index of the inserted knot in the spline.

    KnotInserted(SplineKnotIndex)

    Updates the KnotLinkCollection indices after a knot has been inserted.

    Declaration
    public void KnotInserted(SplineKnotIndex index)
    Parameters
    Type Name Description
    SplineKnotIndex index

    The SplineKnotIndex of the inserted knot.

    KnotRemoved(Int32, Int32)

    Updates the KnotLinkCollection indices after a knot has been removed.

    Declaration
    public void KnotRemoved(int splineIndex, int knotIndex)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the spline.

    Int32 knotIndex

    The index of the removed knot in the spline.

    KnotRemoved(SplineKnotIndex)

    Updates the KnotLinkCollection indices after a knot has been removed.

    Declaration
    public void KnotRemoved(SplineKnotIndex index)
    Parameters
    Type Name Description
    SplineKnotIndex index

    The SplineKnotIndex of the removed knot.

    Link(SplineKnotIndex, SplineKnotIndex)

    Links two knots positions to each other. If you link knots that are already linked to other knots, then all of the knots link to each other.

    Declaration
    public void Link(SplineKnotIndex knotA, SplineKnotIndex knotB)
    Parameters
    Type Name Description
    SplineKnotIndex knotA

    The first knot to link.

    SplineKnotIndex knotB

    The first knot to link.

    ShiftKnotIndices(SplineKnotIndex, Int32)

    Changes the indices of the KnotLinkCollection to ensure they are valid. This is mainly used when splines or knots are inserted or removed from a SplineContainer.

    Declaration
    public void ShiftKnotIndices(SplineKnotIndex index, int offset)
    Parameters
    Type Name Description
    SplineKnotIndex index

    The SplineKnotIndex of the knot.

    Int32 offset

    The offset to apply on other knots.

    SplineIndexChanged(Int32, Int32)

    Updates the KnotLinkCollection indices after a spline index changes.

    Declaration
    public void SplineIndexChanged(int previousIndex, int newIndex)
    Parameters
    Type Name Description
    Int32 previousIndex

    The previous index of that spline in the SplineContainer.

    Int32 newIndex

    The new index of that spline in the SplineContainer.

    SplineRemoved(Int32)

    Updates the KnotLinkCollection after a spline is removed.

    Declaration
    public void SplineRemoved(int splineIndex)
    Parameters
    Type Name Description
    Int32 splineIndex

    The index of the removed spline.

    TryGetKnotLinks(SplineKnotIndex, out IReadOnlyList<SplineKnotIndex>)

    Gets the knots linked to a specific knot.

    Declaration
    public bool TryGetKnotLinks(SplineKnotIndex knotIndex, out IReadOnlyList<SplineKnotIndex> linkedKnots)
    Parameters
    Type Name Description
    SplineKnotIndex knotIndex

    The SplineKnotIndex of the knot.

    IReadOnlyList<SplineKnotIndex> linkedKnots

    The output list of the knots linked to the specified knot if they exist or null if they do not exist.

    Returns
    Type Description
    Boolean

    Returns true if linked knots are found, false otherwise.

    Unlink(SplineKnotIndex)

    Unlinks a knot from the knots it is linked to. This method unlinks the knot specified, but does not unlink the other knots from each other.

    Declaration
    public void Unlink(SplineKnotIndex knot)
    Parameters
    Type Name Description
    SplineKnotIndex knot

    The knot to unlink.

    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