Graph triggers dirtying of all scenes when recompiling

Forums 💬 NodeCanvas ⚙️ Support Graph triggers dirtying of all scenes when recompiling

  • This topic has 0 replies, 2 voices, and was last updated 3 years ago by Gavalakis.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15405
    orion
    Participant

      It took me a couple of days to find out what was causing it, but I ended up being able to “fix it” with one line in the UndoUtility of CanvasCore.

      The issue

      Whenever I recompile scripts, all my scenes get set dirty, which is driving me up the wall.

      The cause

      Since I have a complex scene setup, I expected all kinds of culprits, like Layout Groups, Aspect Ratio Fitters, etc. I’m pretty sure there’s a Unity issue deep down in there still. But replacing them did not do the trick. Somehow, Unity’s LayoutRebuilder’s PerformLayoutControl got triggered, when scripts get recompiled, which targets ILayoutSelfController and others and causes UI objects across the whole hierarchy to become dirty.

      PerformLayoutControl, in turn, gets triggered by Unity’s Undo system. RegisterCompleteObjectUndo, specifically (and others). And this call I found in CanvasCore’s UndoUtility (RecordObjectComplete).

      The fix

      Given that it’s called from all over the place, I figured EditorApplication.isCompiling would do the trick, but it happens just after compiling, so it’s already false. EditorApplication.isUpdating, however, is not.

      So adding
      if (UnityEditor.EditorApplication.isUpdating) return;

      seems to do the trick.

      Conclusion

      It’s likely that this issue is not reproducible in a simple scene. I’m pretty sure there’s something wrong with Unity’s layout system because, without UI things, it’s not an issue.
      Nonetheless, it’d be awesome if you could include this fix in future versions, so I don’t have to go looking for this issue all over again once I’ve forgotten all about it and update NodeCanvas.

      Thanks!

      #15410
      Gavalakis
      Keymaster

        Hello,

        No problem adding this hotfix 🙂 I will try it out and if it doesn’t affect something (I doubt it can in any way), I will add it.

        Thanks!

        #15409
        orion
        Participant

          Excellent, much obliged!

          #15408
          orion
          Participant

            I have noticed that this issue still persists in the latest version. Is there a problem with adding the fix?

            #15407
            Gavalakis
            Keymaster

              Hey,

              I haven’t pushed an update with this fixed yet. The latest update was in February. You suggested this fix in March 🙂 I have added it and will be there in the next version. I haven’t encountered any issues with this fix.

              Thanks!

              #15406
              orion
              Participant

                Oh, my bad. Should have checked more closely. I just happened to get an update and I figured it was newer, but apparently it wasn’t. Keep up the good work!

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.