2D Toolkit Forum

2D Toolkit => Support => Topic started by: esdot on August 15, 2014, 05:15:37 am

Title: Mesh Sorting Incorrect when using Bottom-Right render order
Post by: esdot on August 15, 2014, 05:15:37 am
For some reason, the render mesh's appear to be ordered correctly in the Editor pane, but in the game preview, they are incorrect:
http://cl.ly/image/0g0M0u1E412S

You can see the overlap at the bounds of the mesh.

Seems to be related to the way z-index is assigned. It's currently:
Mesh_0_1 - -1e06
Mesh_1_0 - -3e06

Which looks fine in editor, but is broken in game.

If I manually type in:
Mesh_0_1 - -1e05
Mesh_1_0 - -3e05

It renders correctly. So maybe some weird precision bug with the unity renderer?

I know I can probably fix this at runtime with a simple script, but thought you might like to know.
Title: Re: Mesh Sorting Incorrect when using Bottom-Right render order
Post by: unikronsoftware on August 15, 2014, 11:40:48 am
I wouldn't bother with z indexing. Modify the code to write out the correct Renderer.SortingOrder value so it is guaranteed to be in the right order. This overrides the z values
Title: Re: Mesh Sorting Incorrect when using Bottom-Right render order
Post by: esdot on August 15, 2014, 03:33:45 pm
Ok cool thx, will do for now. Are you planning on patching the issue?
Title: Re: Mesh Sorting Incorrect when using Bottom-Right render order
Post by: unikronsoftware on August 16, 2014, 11:57:21 am
Dont plan on doing anything with sorting order in the toolkit - its too specific to the game, and theres no reliable way to cascade these in Unity...