Author Topic: Anchors not updating inside UIPanel  (Read 3464 times)

Samuraisa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Anchors not updating inside UIPanel
« on: June 09, 2014, 03:27:36 AM »
Our project has several 2D NGUI UIs:
From top to bottom:
1) Fade effect
2) Loading screen
3) Main menu
4) Ingame HUD and menu (didn't used to reproduce the issue)
They all have the same setup except depth value (attachment 4).

The first scene has gameObject with Fade effect and Loading screen UIs (2 deactivated gameObjects). This gameObject has some loading manager to load scene with Main menu UI in that order:
- activating Loading screen
- load MainMenu scene, Main menu screen activating here
- activating Fade effect screen with alpha increasing (fade in effect)
- deactivating loading screen
- Fade effect screen with alpha decreasing and self deactivation in the end

And point is that after all this steps widgets anchored to Main menu UI root don't update their position on resolution change but at the same time in "Scene" window panel borders update their size correctly (attachments 1-3). I figured out that setting
  1. mAnchorsCached = false;
for UIRect of Main menu panel do the things for me and everything back to work again.
I've tried to reproduce the issue on the new clear project, but it failed :) Maybe it's somehow related to script execution order (I have no rights to for it in our project)? Can u say where is the root of the problem can be?

P.S. Если моим кривым английским вопрос непонятен, можно я переспрошу на русском?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Anchors not updating inside UIPanel
« Reply #1 on: June 09, 2014, 03:36:24 AM »
It's likely an order of execution issue, yes. Possibly when children get activated before parents. Unity tends to do that in some cases, as absurd as it sounds.

Samuraisa

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Anchors not updating inside UIPanel
« Reply #2 on: June 09, 2014, 01:31:34 PM »
Leaving only 1 static camera for all UIs outside UIRoots and removing all unnecessary cameras inside each UIRoot fixed it for me! Thanx for your reply!