How do you get unique vertex data from a mesh?

Hi,

I was wondering how to get unique vertex data from a mesh. Take the default cube for example. As you probably know, unity keeps track of 24 vertices. However, a cube only has 8 unique vertices.
I’m trying to draw a line from a given point to each of the vertices of the cube. If I use unity’s vertices array, I’ll be drawing a total of 24 lines instead of the 8 lines that I want. This could be brutally unefficient in the long run. Is there any way to get the unique vertices without filtering the array manually?

Thanks,

Sam

The reason for 24 vertices is because they are split so that each face will have correct normals and UV maps. There’s no reason you can’t have just 8 vertices–the lighting will be messed up and you wouldn’t be able to texture it properly, but if the cube isn’t meant for display, you can keep the vertices unique and not split them. Otherwise you have to go through the vertex array and remove duplicates yourself.