Author Topic: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9  (Read 7831 times)

kittikun

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 46
    • View Profile
Hi,

I have multiples UI prefabs that I keep saved as disabled (to avoid the logic to run when I pooling them)

I used to use AdjustDepth with custom values that all the widgets where properly updated.
Now, since you've added at NGUITools.cs:589


  1. if (w.panel != panel) continue;

Not all widgets are getting updated.

Why wouldn't some widget panel be set and not others ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
« Reply #1 on: August 13, 2014, 06:59:17 AM »
The idea is to stop once a new panel gets encountered, since adjusting depths of widgets belonging to a sub-panel won't have any effect (you need to adjust that panel's depth instead). If you want to bring something forward, bring the panel forward instead.

kittikun

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 46
    • View Profile
Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
« Reply #2 on: August 13, 2014, 08:48:55 AM »
This approach won't work with my case

We are using only one panel and the menu showing up are only widgets.

Imagine a dialog showing up (it's a prefab containing an UISprite with other parts as its child) then you want to show another dialog from a prefab on top of it (but it's not hiding it entirely)

I was using NGUITools.CalculateNextDepth and adjusted by the difference of the prefab depth and the current dialog

So there is no panel used

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
« Reply #3 on: August 14, 2014, 06:45:52 AM »
So why is the check failing in your case? Is the panel null? Are you enabling a game object then immediately try to adjust its depth? Try broadcasting "CreatePanel" on it first.

kittikun

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 46
    • View Profile
Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
« Reply #4 on: August 14, 2014, 11:06:40 PM »
Yes, I was calling SetActive then immediately adjusting the depth so some widgets had their panels correctly set but not some others

calling CreatePanel fixed the issue thank you