Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Destroying or manipulating cloth crashes Unity

Discussion in 'Physics' started by QuinnWinters, Dec 30, 2023.

  1. QuinnWinters

    QuinnWinters

    Joined:
    Dec 31, 2013
    Posts:
    494
    I've been working on a project for 7 years in Unity 5.6.4f1 (I can't upgrade due to depreciated assets), and all that time I've had cloth physics in the game that have worked just fine. Starting today for no apparent reason, destroying or in any way manipulating multiple objects with a cloth component on them crashes Unity. Hours of debugging show the root cause to be the manipulation of more than a handful of cloth objects within a few seconds. I can't even re-parent the transforms via script without Unity crashing. I can, however, destroy the objects manually in the editor without it crashing. I can't reproduce the issue in a fresh project even when ~instantly instantiating and destroying thousands of copies of the cloth object in question. Any ideas how I could fix this in my project, perhaps by replacing some core files from a backup or clearing metadata or something else unusual? I've tried all kinds of wild things to fix it with no luck.

    Update: I've been unable to fix the issue, so to work around it I've begun only instantiating the number of cloth items needed rather than a starting pool of dozens of them. It's not optimal, as I've now got the game instantiating and manipulating the cloth items during frame-rate sensitive gameplay, but it's prevented the crashing.
     
    Last edited: Dec 31, 2023