Search Unity

Feedback [Feature Request] Cloth.vertices without Garbage generation

Discussion in 'Physics' started by AndrewRH, Aug 7, 2019.

  1. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Feature Request:

    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.

    Please let me know your thoughts.

    Thanks,
     
  2. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    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.
     
    AndrewRH likes this.
  3. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    Oh this is music to my ears :) Thanks for the update - super appreciated to be kept in the loop! I will not submit the bug-report for this one then.
     
  4. yant

    yant

    Unity Technologies

    Joined:
    Jul 24, 2013
    Posts:
    596
    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.
     
  5. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    *bump* ;) any idea what the status is of that pull request?
     
  6. AndrewRH

    AndrewRH

    Joined:
    Jan 24, 2012
    Posts:
    2,806
    *bump* anyone know when this pull request might come through? :)