Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Donkey111 on September 22, 2013, 12:08:52 PM

Title: Sprite sorting question
Post by: Donkey111 on September 22, 2013, 12:08:52 PM
Sprite A and Sprite B both use the same atlas and are int the same anchor. Sprite A has a depth of -8. Sprite B has a depth of 2. Yet Sprite A sorts in front of Sprite B!

Sprite B is a dynamically created pre-fab. Could that be a reason it is not sorting in front of the background sprite? Any suggestions?
Title: Re: Sprite sorting question
Post by: ArenMook on September 23, 2013, 08:09:23 AM
Upgrade to 3.0. 2.7 and earlier still have panels split draw calls and batch everything together. 3.0 is more careful in the matter and creates extra draw calls as needed.
Title: Re: Sprite sorting question
Post by: Donkey111 on September 23, 2013, 01:57:01 PM
My game is pretty far along. I'm concerned upgrading will require a lot of re-work.

But if that is the only solution, I will upgrade.
Title: Re: Sprite sorting question
Post by: anord on September 23, 2013, 10:41:23 PM
NGUI 3.0 sorting question

prefab A - depth 100
Instantiate prefab A

ex) layer

A - depth 100
<--- how can i put some object between A?
A - depth 100
Title: Re: Sprite sorting question
Post by: Nicki on September 24, 2013, 04:50:01 AM
Donkey: You might have a Panel on the generated prefab - people tend to accidentally add it by editing the prefabs in the root of the hierarchy. Kill that off and it should sort properly.
Otherwise, make a backup and try to upgrade to 3.0 - if it fails, roll back and check the prefab properly.

anord: You should change the depth values run time so it's sorted the way you want.