Cloth Vertices differ from Mesh Vertices

I have been working with the cloth component and found myself in need to create a script to edit constraints of specific submeshes automatically, as sometimes it’s just impossible to paint the right vertices through the UI and it’s very time consuming…

The thing is, the ammount of vertices of the cloth component isn’t the same as from the mesh renderer.

I’ve already tried to eliminate duplicated vertices from the mesh, it bring the ammount closer, but it’s still not the same… so i thought of forcing the cloth component vertices to be the same as the mesh, but the vertices from the cloth component seem to be read only…

Any sugestions? Anyone had or has the same issues?

The cloth has more or less vertices?

Less

That’s a normal thing. A cloth algorithm will skip vertices with same position, as they would break the cloth structure, leading to separated pieces of cloth There was a discussion once in this forum, and someone build some sort of mapping of vertices and put it on github if I remember correctly.

I have searched, but didn’t found anything any code… i found someone talking about something similar, so i did a script that creates a dictionary and removes duplicated vertices, it gets closer to the number, but it’s still higher.

see here : https://discussions.unity.com/t/596959