Author Topic: Problem with Depth  (Read 25355 times)

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Problem with Depth
« on: February 02, 2016, 05:11:22 PM »
I have been trying to put various labels on top of sprites, but for some reason the labels won't render on top of the sprites.  I set the depth of the sprites to -5 and the labels to -3.  Yet, the labels won't render on top of the sprites.  Is there something that needs to be done in order to force widgets to render at the right depth?  This has been a problem for a while and I really want to get to the bottom on it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with Depth
« Reply #1 on: February 04, 2016, 08:58:57 PM »
Assuming you aren't using NGUI 2, the only reason why -3 would appear below -5 would be different panels being used by the widgets. Camera depth > Panel depth > Widget depth.

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: Problem with Depth
« Reply #2 on: February 06, 2016, 02:10:50 PM »
That's the thing, the widgets are on the same panel.  I'm trying to make a ability bar like Diablo, but I want the key used to fire the ability to be in front of the graphic.  Everything is on the same panel, yet the text never shows up.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with Depth
« Reply #3 on: February 07, 2016, 12:26:11 AM »
How is it created? If you are changing the transform parent at any point without letting NGUI know, that too would cause an issue.

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: Problem with Depth
« Reply #4 on: February 10, 2016, 07:19:48 PM »
I don't move panels without using one of the NGUI scripts (UIPosition, etc.).  All UI elements are part of the main scene and aren't created on the fly.  Is there something else that would cause problems with how depth is calculated?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with Depth
« Reply #5 on: February 12, 2016, 08:34:57 PM »
What's UIPosition? What version of NGUI are you using?

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: Problem with Depth
« Reply #6 on: February 13, 2016, 06:01:06 PM »
What's UIPosition? What version of NGUI are you using?

Sorry.  Meant TweenPosition.  I should have caught that.  Just wanted to state that I only use the Tween scripts you provide to move things.  I'm also using the most recent version of NGUI.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with Depth
« Reply #7 on: February 15, 2016, 02:33:37 PM »
Then I am back to my original answer. There is no reason for what you're describing. Same panel, same game object layer, latest NGUI, different widget depth = widget with the higher depth will be drawn on top.

Darkness

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 90
    • View Profile
Re: Problem with Depth
« Reply #8 on: February 16, 2016, 04:42:00 PM »
There there is something wrong, because I'm trying to put the text on top of a sprite and it's not showing up.  The depth is right for each object and it's not being drawn.  There's obviously something going on, because it should work, but it's not.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with Depth
« Reply #9 on: February 18, 2016, 06:55:53 PM »
Well, all I can suggest is submit a repro case for me to look at. You can email it to support [at] tasharen.com