Author Topic: Layer issue with ingame sprite [4.3]  (Read 3379 times)

Wonse

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Layer issue with ingame sprite [4.3]
« on: March 01, 2014, 08:09:26 AM »
Hello, i have an issue with sprites.

I have somes sprites in my games. (using 4.3 sprites)  but some, who  should be  behind the HUD, are before it.

in this image, i want my coins to be behind the HUD.



Is there a way to define the NGUI sprite layer ? or i have to change all my other sprites layers, but not GUI ?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Layer issue with ingame sprite [4.3]
« Reply #1 on: March 01, 2014, 02:09:00 PM »
So what it using NGUI and what's not?

If the three yellow are in front of the NGUI stuff, that means either the NGUi camera is rendering it, or you have a second camera rendering in front of the NGUI camera. Check the depth on the cameras.

Wonse

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Layer issue with ingame sprite [4.3]
« Reply #2 on: March 01, 2014, 02:55:55 PM »
I only have one camera,

the 3 yellow are sprites in the scene
 the pause menu, the resume button, are NGUI elements (UI2Dsprite)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Layer issue with ingame sprite [4.3]
« Reply #3 on: March 01, 2014, 08:59:58 PM »
NGUI sorts all widgets based on depth, however panels also have depth and their depth supersedes widget depth.

So in simplest explanation, first everything is sorted by panel depth, then each panel sorts its widgets based on widget depth.