Support => NGUI 3 Support => Topic started by: kittikun on August 13, 2014, 05:58:29 AM
Title: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
Post by: kittikun on August 13, 2014, 05:58:29 AM
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
if(w.panel!= panel)continue;
Not all widgets are getting updated.
Why wouldn't some widget panel be set and not others ?
Title: Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
Post by: ArenMook 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.
Title: Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
Post by: kittikun 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
Title: Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
Post by: ArenMook 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.
Title: Re: NGUITools.AdjustDepth not working a expected with prefabs since 3.6.9
Post by: kittikun 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