Author Topic: Panel/sprite NGui depth  (Read 3149 times)

sylo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 2
    • View Profile
Panel/sprite NGui depth
« on: March 08, 2017, 12:23:07 PM »
Hi,

I am working on a game and I use NGUI. I have a problem with the depth of my sprites.

I have my UIRoot which have a Panel (depth: 1), it has a child which contains another object, srollview(sprite with a depth at 2), on this last object there is 3 button (depth: 3).

And there is a second object attached to the camera in UIRoot, this is a sprite with a depth at 4.

But the problem is that my sprite with a depth at 4 is under the sprite with a depth at 1 and under all of my buttons with a depth at 3.

How can I change that ? ;)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Panel/sprite NGui depth
« Reply #1 on: March 10, 2017, 11:30:49 AM »
Camera depth > Panel depth > Widget depth.

The depth values don't cross these boundaries. All widget depths are used to sort widgets within the panel they belong to. Panel depth simply changes the order in which these panels get drawn. They don't affect widgets inside. For example:

Panel A (depth 0)
- Widget A (depth 10000)
Panel B (depth 1)
- Widget B (depth 0)

Widget A will be drawn before widget B, because it belongs to a panel that has a lower depth value than the panel of widget B.