Nullable in Prefab causing Unity to freeze regression

Issue #909 new
smugdev created an issue

Hello.

I’ve been having trouble with a Odin Inspector bug and it turns out that it’s an old bug that returned.
Adding a certain kind of property to a prefab causes Odin to freeze Unity.

  • Unity 2022.2
  • Windows 11
  • Full Odin (not just editor only)
  • Odin 3.1.10.0 (happened on the patch release before this one, too)
  • Original bug: issue #410
  • Files from the original issue can be used to reproduce
  • For the sake of completion:

    • Add a nullable (e.g. float?) property to a script derived from SerializedMonoBehaviour
    • Attach it to a prefab
    • Add the prefab to a scene
    • Unity will hang the moment the prefab is selected inside of the scene and the inspector is drawn
    • (Prefab isolation mode works fine. Prefabs in scenes are broken)

Before finding the old issue here, I switched to the source version of Odin and debugged myself. I managed to find the culprit.

  • `PropertyTree.InvokeDelayedActions()` processes a bunch of delegates inside of a for loop
  • Inside of the last delayed action, it ends up calling PropertyTree.DelayAction(), thus enqueueing another action
  • If there are 3 delayed actions for example, the loop ends up working like this:

    • 0/3
    • 1/3
    • 2/3
    • 3/4
    • 4/5
    • 5/6
  • And Odin ends up in and endless loop, thus freezing the Unity editor

Comments (0)

  1. Log in to comment