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.
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.
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!
Author
Posts
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.