Hi,
We are getting a NullReferenceException when the UIPanel attempts to get the cached transform. This only happens under certain conditions. This is the Exception:
NullReferenceException
at UnityEngine.Component.get_transform () [0x00000] in <filename unknown>:0
at UIPanel.LateUpdate () [0x00000] in <filename unknown>:0
The only way I can get the issue to happen is if I show UIPanel A in Scene 1, destroy UIPanel A and then load Scene 2 (via additive), it will trigger the exception on another UIPanel in Scene 2 (always the same UIPanel, perhaps because it's first child of UIRoot). I have confirmed that UIPanel A is destroyed before Scene 2 is loaded, and that there are no objects referencing it (or it's children). I see nothing wrong with UIPanel A, I can display it within Scene 2 and destroy it without any issue, likewise in Scene 1 (before loading Scene 2). There is no relation between the UIPanels involved in this scene either.
Once Scene 2 is loaded, Scene 1 is unloaded and both scenes have their own UIRoot, so that means for a short while, both scenes are active, and thus there are 2 active UIRoots. Is there a potential issue with having 2 UIRoots present (all be it in different scenes) at the same time? This problem is a bit of a headache, because the exception is thrown every update after it occurs and essentially breaks everything NGUI related.
We are using NGUI 3.11.1 (we can't upgrade due to the sorting changes which breaks stuff for us) and Unity 5.5.1.p1.
Thanks