Author Topic: Atlas layers and sprite order  (Read 3665 times)

triggly_glix

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Atlas layers and sprite order
« on: October 22, 2013, 06:44:06 AM »
So... I'm running NGUI 2.7 and my basic problem is that if I have two atlases - and i have sprites from Atlas A at the back and then in the middle Atlas B and then in the front more sprites from Atlas A... then all the sprites from Atlas A will be batched into one draw call and will all either be behind or in front of Atlas B...
Is there no way around this at all?
What I would like is that the sprites from Atlas A were split into two draw calls so that the draw order of the scene could be maintained.

thanks...

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlas layers and sprite order
« Reply #1 on: October 22, 2013, 08:23:21 AM »
This is an old question, and there used to be a sticky about it.

You can use a secondary UIPanel to split off a new draw call.

Widgets in the same material, in the same panel are batched together.

triggly_glix

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Atlas layers and sprite order
« Reply #2 on: November 14, 2013, 08:09:49 AM »
thanks -

i've just spent an hour trying to get something very simple along these lines to work -

i'm now moving the gameobjects to another panel when i want them to appear behind the object... and it's still not working

i see it clearly in the editor - i move a sprite on the Z in one panel and sprites that are from the same atlas but in another panel flicker behind and in front of objects...
could this be because i've moved the sprite to a new panel programatically - is there some refresh call i need to let NGUI know i've moved it to another panel and that it should be batched separately?
thanks!
 
just to be clear I've got 2 panels within the same UI widget ... and i'm trying to have some sprites from the same atlas draw in front of and behind an object
« Last Edit: November 14, 2013, 08:16:43 AM by triggly_glix »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas layers and sprite order
« Reply #3 on: November 14, 2013, 02:01:46 PM »
NGUI 2.7 is still not 100% depth-based. Only NGUI 3 is. Multiple panels in 2.7 still require adjusting of Z, if I recall correctly.