docs.unity3d.com
    Show / Hide Table of Contents

    Class SharedVertex

    Defines associations between vertex positions that are coincident. The indexes stored in this collection correspond to the positions array.

    Inheritance
    Object
    SharedVertex
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.ProBuilder
    Syntax
    [Serializable]
    public sealed class SharedVertex : ICollection<int>, IEnumerable<int>, IEnumerable
    Remarks

    Coincident vertices are vertices that share the same coordinate position, but are separate entries in the vertex array.

    Constructors

    SharedVertex(IEnumerable<Int32>)

    Creates a new SharedVertex from the specified indices.

    Declaration
    public SharedVertex(IEnumerable<int> indexes)
    Parameters
    Type Name Description
    IEnumerable<Int32> indexes

    An array of indices to set.

    SharedVertex(SharedVertex)

    Creates a new SharedVertex from the specified SharedVertex object.

    Declaration
    public SharedVertex(SharedVertex sharedVertex)
    Parameters
    Type Name Description
    SharedVertex sharedVertex

    The SharedVertex object to copy.

    Properties

    Count

    Gets the number of items in this collection.

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

    The length of this collection

    Implements
    ICollection<T>.Count

    IsReadOnly

    Gets whether this collection is read-only.

    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    Boolean

    The value of the IsReadOnly flag.

    Implements
    ICollection<T>.IsReadOnly

    Item[Int32]

    Gets and sets the vertex by index.

    Declaration
    public int this[int i] { get; set; }
    Parameters
    Type Name Description
    Int32 i

    The index to access.

    Property Value
    Type Description
    Int32

    Methods

    Add(Int32)

    Adds a new entry using the specified index.

    Declaration
    public void Add(int item)
    Parameters
    Type Name Description
    Int32 item

    The index to add.

    Implements
    ICollection<T>.Add(T)

    Clear()

    Resets this SharedVertex object to an empty collection.

    Declaration
    public void Clear()
    Implements
    ICollection<T>.Clear()

    Contains(Int32)

    Returns whether the specified item exists in this collection.

    Declaration
    public bool Contains(int item)
    Parameters
    Type Name Description
    Int32 item

    The index of the item to check.

    Returns
    Type Description
    Boolean

    True if the index was found; false otherwise

    Implements
    ICollection<T>.Contains(T)

    CopyTo(Int32[], Int32)

    Copies the elements of this collection to an array, starting at the specified arrayIndex.

    Declaration
    public void CopyTo(int[] array, int arrayIndex)
    Parameters
    Type Name Description
    Int32[] array

    The destination array.

    Int32 arrayIndex

    The index in the destination array where the collection items will be copied.

    Implements
    ICollection<T>.CopyTo(T[], Int32)

    GetEnumerator()

    Returns an enumerator that iterates through this collection.

    Declaration
    public IEnumerator<int> GetEnumerator()
    Returns
    Type Description
    IEnumerator<Int32>

    An IEnumerator object that you can use to iterate through the collection.

    Implements
    IEnumerable<T>.GetEnumerator()

    GetSharedVertexLookup(IList<SharedVertex>, Dictionary<Int32, Int32>)

    Creates a lookup Dictionary in order to quickly find the index of a SharedVertex in the sharedVertices array using a vertex index.

    Declaration
    public static void GetSharedVertexLookup(IList<SharedVertex> sharedVertices, Dictionary<int, int> lookup)
    Parameters
    Type Name Description
    IList<SharedVertex> sharedVertices

    A collection of SharedVertex values.

    Dictionary<Int32, Int32> lookup

    A Dictionary where the 'key' represents an index in the Mesh positions array, and the 'value' is the index of its placement in the sharedVertices array.

    GetSharedVerticesWithPositions(IList<Vector3>)

    Creates a new array of SharedVertex objects by comparing points in the specified positions collection.

    Declaration
    public static SharedVertex[] GetSharedVerticesWithPositions(IList<Vector3> positions)
    Parameters
    Type Name Description
    IList<Vector3> positions

    A collection of Vector3 positions to test for equality.

    Returns
    Type Description
    SharedVertex[]

    A new SharedVertex array where each item is a list of indices that share the same position.

    Examples
    var mesh = gameObject.AdComponent&lt;ProBuilderMesh>();
    mesh.SetPositions(myNewPositions);
    mesh.SetFaces(myNewFaces);
    mesh.SetSharedIndexes(SharedVertex.GetSharedVerticesWithPositions(myNewPositions));
    

    Remove(Int32)

    Removes the specified item from this collection.

    Declaration
    public bool Remove(int item)
    Parameters
    Type Name Description
    Int32 item

    The index of the item to remove.

    Returns
    Type Description
    Boolean

    True if the index was found and removed; false otherwise

    Implements
    ICollection<T>.Remove(T)

    ToString()

    Returns a string that represents this SharedVertex.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    A comma-delimited string (for example &quot;2,0,6,3&quot;).

    Overrides
    Object.ToString()

    Explicit Interface Implementations

    IEnumerable.GetEnumerator()

    Returns an enumerator that iterates through this collection.

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator

    An IEnumerator object that you can use to iterate through the collection.

    Implements
    IEnumerable.GetEnumerator()
    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