Please could you add API hooks for getting the vertices/normals from cloth without GC allocations?
Something like GetVertices(Vertices[ ] myArray) would be great.
The same thing already exists in Mesh.GetVertices to avoid GC allocs.
Currently we’re attaching items to cloth vertices, so each frame we’re calling the vertices property, and with 12 characters and 20 attachments that quickly becomes about 2MB per frame We can’t have smooth playback as the garbage collection happens too frequently and takes too long.
I think it should be quite an easy thing to add to the API.
Hey Andrew, we actually have a pull request for this, in the queues for being merged. Hopefully a back-port is an option too. I’ll let @SeanParkinson update you.
Yeah, this won’t get accepted as a bug report - because it may be treated as a feature request if you take into consideration that .normals and .vertices allocating API was added a while back, before we had this focus on performance by default. Thanks for the heads up.