Author Topic: make UISprite widget always on top, no matter the atlas used  (Read 2448 times)

Slyfox

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
make UISprite widget always on top, no matter the atlas used
« on: September 02, 2013, 09:38:56 AM »
Hi, I would like to know if there is a way to make a UISprite always on top of any other widgets, even when multiple atlases are used.
 
I know about making the depth very high and z in the negative but if let's say one atlas is used in the background, then one in the front, then I wish to use the first atlas again in the very front for the cursor, then the cursor will be drawn as the same level as the background.

So even if it cost one extra draw call, I would like that cursor to be drawn separately in front of everything else.(basically as a special case)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: make UISprite widget always on top, no matter the atlas used
« Reply #1 on: September 02, 2013, 05:53:34 PM »
Yeah, just use the Overlay shader that comes with NGUI.

Slyfox

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: make UISprite widget always on top, no matter the atlas used
« Reply #2 on: September 02, 2013, 07:19:06 PM »
thanks for the respond, though there seems to be more problem now since all icons are on top of the tooltip

ENAY

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 248
    • View Profile
Re: make UISprite widget always on top, no matter the atlas used
« Reply #3 on: September 03, 2013, 03:48:07 AM »
Stick that sprite in a separate layer, add a UIPanel to the Layer Object and then raise the UIPanel object everything else, then it will definitely be on top of everything else, albeit, an extra draw call.

Slyfox

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: make UISprite widget always on top, no matter the atlas used
« Reply #4 on: September 03, 2013, 07:16:39 AM »
thanks Enay, it does work.