Author Topic: UIPanel depth not relative to parent UIPanel  (Read 4726 times)

Asse

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 70
    • View Profile
UIPanel depth not relative to parent UIPanel
« on: October 29, 2013, 02:04:32 PM »
Hey folks,

until NGUI 3.0 I've used the z value for bringing windows to the front/back.

Now I use the depth value of the main UIPanel of a window ui. Problem is that the depth values of all the other UIPanels under the main UIPanel aren't relative so when I give a window a depth value of 10 and some other panels inside the window use 0 (which I assume to be relative), they appear behind the main panel of their window.

Any solutions for that problem?

PS: I use other UIPanels inside a window for e.g. clipping areas.
« Last Edit: October 29, 2013, 02:10:25 PM by Asse »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel depth not relative to parent UIPanel
« Reply #1 on: October 29, 2013, 04:40:49 PM »
True. Panel depths were never meant to be cumulative. I'll change the NGUITools.AdjustDepth function to take that into consideration so that when you adjust the depth of one panel it will affect depth of all panels underneath.

DGord

  • Guest
Re: UIPanel depth not relative to parent UIPanel
« Reply #2 on: November 13, 2013, 09:57:09 PM »
Was this fixed with the latest update?

I had to do some hackery to get around this, but I haven't checked since I updated today (nov 13). I'm working on a card game, and I was nesting cards with the assumption that the z-ordering of the cards would be taken care of by parenting game objects. I'm very happy to hear that this is going to be cleared up, as its the very first issue that's caused me to think about looking elsewhere.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel depth not relative to parent UIPanel
« Reply #3 on: November 14, 2013, 01:52:51 PM »
Two different issues I think? Z-ordering depends on the depth values, not the hierarchy. By default when you add new widgets, they assume highest depth + 1 value. Unity's upcoming GUI is actually all hierarchy-based, but whether it's a good thing or a bad thing still remains to be seen.