Class SharedVertex
Defines associations between vertex positions that are coincident. The indexes stored in this collection correspond to the ProBuilderMesh.positions array.
Coincident vertices are vertices that despite sharing the same coordinate position, are separate entries in the vertex array.
Inheritance
System.Object
SharedVertex
Syntax
[Serializable]
public sealed class SharedVertex : ICollection<int>, IEnumerable<int>, IEnumerable
Constructors
SharedVertex(IEnumerable<Int32>)
Create a new SharedVertex from an int array.
Declaration
public SharedVertex(IEnumerable<int> indexes)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<System.Int32> |
indexes |
The array to copy.
|
SharedVertex(SharedVertex)
Declaration
public SharedVertex(SharedVertex sharedVertex)
Parameters
Type |
Name |
Description |
SharedVertex |
sharedVertex |
The array to copy.
|
Properties
Count
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
IsReadOnly
Declaration
public bool IsReadOnly { get; }
Property Value
Type |
Description |
System.Boolean |
|
Item[Int32]
Declaration
public int this[int i] { get; set; }
Parameters
Type |
Name |
Description |
System.Int32 |
i |
The index to access.
|
Property Value
Type |
Description |
System.Int32 |
|
Methods
Add(Int32)
Declaration
public void Add(int item)
Parameters
Type |
Name |
Description |
System.Int32 |
item |
|
Clear()
Declaration
Contains(Int32)
Declaration
public bool Contains(int item)
Parameters
Type |
Name |
Description |
System.Int32 |
item |
|
Returns
Type |
Description |
System.Boolean |
|
CopyTo(Int32[], Int32)
Declaration
public void CopyTo(int[] array, int arrayIndex)
Parameters
Type |
Name |
Description |
System.Int32[] |
array |
|
System.Int32 |
arrayIndex |
|
GetEnumerator()
Declaration
public IEnumerator<int> GetEnumerator()
Returns
Type |
Description |
System.Collections.Generic.IEnumerator<System.Int32> |
|
GetSharedVertexLookup(IList<SharedVertex>, Dictionary<Int32, Int32>)
A SharedVertex is used to associate discrete vertices that share a common position. A lookup
Dictionary provides a fast way to find the index of a SharedVertex in the
sharedVertices array with a vertex index.
Declaration
public static void GetSharedVertexLookup(IList<SharedVertex> sharedVertices, Dictionary<int, int> lookup)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IList<SharedVertex> |
sharedVertices |
A collection of SharedVertex values.
|
System.Collections.Generic.Dictionary<System.Int32, System.Int32> |
lookup |
A Dictionary where the Key represents an index in the Mesh positions array, and the
Value is the index of it's placement in the sharedVertices array.
|
GetSharedVerticesWithPositions(IList<Vector3>)
Create a new array of SharedVertex objects by comparing points in the passed positions collection.
Declaration
public static SharedVertex[] GetSharedVerticesWithPositions(IList<Vector3> positions)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IList<Vector3> |
positions |
A collection of Vector3 positions to be tested for equality.
|
Returns
Type |
Description |
SharedVertex[] |
A new SharedVertex[] where each SharedIndex is a list of indexes that are sharing the same position.
|
Examples
var mesh = gameObject.AdComponent<
mesh.SetPositions(myNewPositions)
mesh.SetFaces(myNewFaces)
mesh.SetSharedIndexes(SharedVertex.GetSharedVerticesWithPositions(myNewPositions))
Remove(Int32)
Declaration
public bool Remove(int item)
Parameters
Type |
Name |
Description |
System.Int32 |
item |
|
Returns
Type |
Description |
System.Boolean |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.Object.ToString()
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.