Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Failed to unpersist: Bug

Discussion in 'Prefabs' started by punk, Jan 28, 2019.

  1. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    382
    I've been having this bug popup for years sometimes it get fixed and goes away for a while, but it's back. Seems to be related to prefabs (Using 2018.3.3f1)

    I don't know what causes it, but there is two things that happen - either

    1. When you press play you get a bunch of error message such as

    Failed to unpersist: GameObject ID: -987586 FileID: 1723775924
    Failed to unpersist: MonoBehaviour ID: -987584 FileID: 1851524827
    Failed to unpersist: MonoBehaviour ID: -987582 FileID: 1851524828

    your scene prefabs get destroyed and you have to press stop unload and reload your scene

    2. When to press stop you get the bunch of error messages as above and then it deletes everything in your scene, you then have to unload and reload your scene

    Either way you're scene gets trashed, seems like its been around since multi scene editing

    Could somebody from Unity give some insight on what this 'Failed to unpersist' actually means, like under what conditions is it thrown? that way I can attempt to get to the bottom of it and submit a repo

    if anybody else has any insight that would be helpful thanks
     
    Last edited: Jan 28, 2019
  2. diviocy

    diviocy

    Joined:
    Apr 8, 2017
    Posts:
    3
    I had this occur with one of my scenes recently. Each time I made a change and entered play mode, the entire scene would get nuked with a ton of failed to unpersist errors. I could avoid this by saving my change, unloading and reloading the scene, but that's no way to work.

    What ended up working for me was closing Unity, deleting the Library folder in the project directory, and letting Unity regenerate it all on next load. This will take some time, but it's worth a shot. I'm on 2018.1.7f1.
     
    punk likes this.
  3. punk

    punk

    Joined:
    Jun 28, 2013
    Posts:
    382
    Thanks for the suggestion, i've read that works for some people. It literally takes days upon days to rebuild my library these days cos its so big, so i'm rarely keen to do it, i did try it a few years back, but no luckl

    Currently i've found a work around by adding a delay of .1f seconds to start of the game cycle. If I remove the delay it starts happening again, it seems reated to prefab references in multiple scenes when calling Instantiate. Anyways it fixed it.

    But now I'm curious why it even happens at all.
     
  4. diviocy

    diviocy

    Joined:
    Apr 8, 2017
    Posts:
    3
    Alright, I've gotten to the point where deleting my library doesn't help, so I must ask about your fix. When you say delay the game cycle, do you mean setting timeScale to 0 at first then setting to 1 at a particular point in time, or something else?

    I'd greatly appreciate the help!