Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Spacez on September 11, 2013, 08:30:58 AM
-
i had parallel backgrounds created using Unity Plane + Texture, but i want to reimplement them using NGUI Atlas in order to reduce some Draw Calls.
the problem is when i finished reimplementing using Atlas, then i tested the result and found that some backgrounds on the back sometimes show in the front !
here is what i tried (but didnt solve the problem :( )
- checked that each background is exactly next to each other
- reimplemented again but separating atlas depends on the layer of parallel (the 1st front use 1 atlas, 2nd front use 1 atlas, ...)
- the parallel algorithm i used works well with normal unity plane + texture
Thanks in advanced for every help,
-
Check the FAQ. Depth vs Z was covered a million times in this forum. Coincidently, one of NGUI 3.0.0's features fixes this difficulty outright.
-
sry, forgot to tell that i also tried adjusting depth and z (as your mentioned in FAQ about them), unfortunately it didnt solve the problem :(
in addition, if you see the picture i attached, you may notice that it is just a part of the texture that show in front (while some part of the same texture is behind). so i guess it's not about z and depth ('cause if i adjust it in the wrong way the whole texture should be front or back, not a part of it)
thanks for the help :D
-
bump! some help pls ;(
-
Well, it looks like you have multiple textures going and the beach one tiles right where it breaks.
I'm assuming you want the clouds to always be behind and the beach to always be in front? Have them not be next to each otehr, but the clouds at z position 10 and beach at 0. IF you're using NGUI 3.0 or 2.7 with the depth sorting enabled, set the depths like they should be and there shouldn't be a problem.
If there's stil a problem, then we need some more information to go by. How many textures are you using? How does your inspector look, what does your scripts do to the textures - maybe they move them to be at the same z position and NGUI gets confused as to which is drawn first etc.
-
thanks for reply Nicki,
the problem has been SOLVED :)
here is what i did (in fact i missed such a simple point :( )
- i tried update my NGUI from 2.6.3 to 2.7.0 and there is 'depth sort' option enabled for me.
- as i told that, i'm creating many sets of background bundle using code (by changing widget sprite name), BUT i forgot that each of the bundle hasnt been created under the same PANEL. (i guess that is the point which NGUI confuses with the depth)
- i added some code so that each bundle will be created under the same panel (which has 'depth sort' enabled'), and the parallel works well !
ps. thanks everyone for the help :)
ps2. marked this thread as solved in case there will be someone having the same problem.