Serialization of interfaces lost for an entire scene if one prefab is deleted

Issue #154 resolved
William Besnard created an issue

I deleted one prefab that had an instance on a scene, this prefab contained some SerializedMonoBehaviours, but after deleting the prefab from the resource folder, all the references to my interfaces were gone on the scene, even when they had absolutely no link to the deleted prefab.

If that's not enough for you to reproduce the bug, I can try to reproduce it and take screenshots.

I'm using Unity 2017 and the last version of Odin

Comments (4)

  1. Tor Esa Vestergaard
    • changed status to open

    I just tried and failed to replicate this, in a variety of ways. I have discovered a multitude of odd interactions with prefabs and Odin-serialized Unity object references, though. I'm currently neck deep in a thorough step-by-step debugging review of how that entire part of the system works, as it seems Unity, in these particular cases, has a lot of very strange behaviour, and many of these cases interact in non-obvious ways. I need to isolate each case, and work out some way to solidly handle it, so right now it's just a lot of step-debugging, logging, and trudging through decompiled Unity source code.

    I've also had the bad luck of falling rather ill (just the flu and fever), so I'm afraid I've been a little woozy lately, and giving you a status update on your other issue simply slipped my mind - sorry about that.

    In general, I'd just advise you to not refer to Unity objects through interfaces on prefabs, right now - or rather, avoid making Odin serialize Unity object references on prefabs. Again, we're sorry for the inconvenience (we do try to caution people not to depend overly on these systems in our words of caution section). This would be easy if we had any control at all over Unity's prefab system and how it handles references to Unity objects, or the order in which it deserializes objects, but this engine is very challenging to work with, sometimes.

  2. Tor Esa Vestergaard

    So I've been finding and fixing a lot of issues with Odin-serialized Unity object references in prefabs. I'm still unsure what exactly caused this to happen, but there are a few things it could possibly have been, a few ways in which such references could just spontaneously choose to vanish. As per my reply to issue #153, Odin-serialized Unity object references in prefabs should now be a lot more reliable. I'm not sure how to confirm that this one is gone, but let me know if you can provoke it again once you've got the new build. I'll leave it open for the duration, to keep it close to mind.

  3. William Besnard reporter

    thanks a lot for the update, and I'll surely be careful about not depending too heavily on this system :)

  4. Tor Esa Vestergaard

    I'm going to mark this one resolved, as a variety of issues that were fixed in the updated build you received could theoretically have combined to cause something that would look a lot like this. Please let me know if anything like it happens again, though.

  5. Log in to comment