Game object render order is unexpected

I make a collection with two game boject:

  • board: z order = 0
  • generator: z order = 1

Board and generator will create hex game obj on init in its bind scrpit.
But the draw order is unexpected like:


I output the hex game obj world postion in console, but it seems ok.

I had spent a long time to solve this, but failed…
Am I miss something important?

How it works in the game engine is the rule not the editor. I’m not super sure what’s going on. Do you have anything else going on with a camera or a custom render script?

Check the sprite to make sure it’s 0,0,0 in the editor?

Are the yellow 5 the “normal” or “empty”?

Any rotation on any of the parents?

What’s the z of the factory?

Try to set the z value of each object based to what you want its z index to be. For example 0.0001 is a valid value, another 0.002, 0003… If you want to be able to use values below or higher than -1 and 1 you will have to edit your render script.

Thanks for your reply!

I use built in render script and has no camera.

In Editor, i set the mother game obj pos as:


the output is to the child hex game obj world positon

Yellow 5 is “normal”, the black is “empty”

I did not set z of any factory, and it would be zero.

Finally, I find the reason: sprite z had been set to -1

But why the follow code get the output z of 1 but not 0
(parent game obj’s z is 1)

print('normal', go.get_world_position('#sprite'))
2 Likes

i seen similar issue today. so made separated objects to control z on sprite