Author Topic: [Solved] Ngui Root shrinks after async loading...  (Read 222 times)

yo_milo

  • Newbie
  • *
  • Thank You
  • -Given: 10
  • -Receive: 2
  • Posts: 36
    • View Profile
[Solved] Ngui Root shrinks after async loading...
« on: October 06, 2017, 11:14:22 AM »
Ngui Root shrinks after async loading and it breaks all my anchors. I do not have any other code to modify the Root's size.

Could it be happening because the Loading has it's own root , which gets destroyed, and the "Level selection" has its own NGUI Root as well?

https://youtu.be/LjiFYA56aSw

It does not happen when I load the "Level selection first" and then I pass to a loading screen.

Edit 1:
I guess what is breaking my stuff is having two 2D UI Roots at the same time and destroying one of them (Because of the loading Async). Do any of you have suggestions on how to solve this?

Edit 2:
I am getting closer to the answer, it is really due to the double 2D UI Root. The camera gets cached by the roots... When the UICamera from the loading gets killed, which nulls the references and makes my anchors change in size to 2w, 2h.
« Last Edit: October 06, 2017, 02:00:14 PM by yo_milo »

yo_milo

  • Newbie
  • *
  • Thank You
  • -Given: 10
  • -Receive: 2
  • Posts: 36
    • View Profile
Re: Ngui Root shrinks after async loading...
« Reply #1 on: October 06, 2017, 01:59:53 PM »
For anyone having the same problem, it is indeed because of the missing reference.
I just added in UIRect 472

  1.         if (mCam == null) {
  2.             ResetAndUpdateAnchors ();
  3.         }
  4.