Positioning on Z-axis messed up in Android build

(Aaaaagh, I just typed this whole question and then I signed in and lost all the text. Really frustrating.)

I have a scene with a Background quad (Z = 0) which is darkgrey, and a parent GameOver Screen with some sprites which makes up a Game Over screen. (Also some other GO’s, but they aren’t relevant)

To toggle the GameOver screen, I simply change the Z value of it to hide it behind the Background quad if I don’t need it. In the editor with the Standalone as platform, it is working fine and I have no problems whatsoever. However, if I change the platform to Android, the GameOver screen appears in front of the Background, see this image:

This is also the case if I deactivate all the scripts, and it was also the case when I wrote a script attached to the GameOver screen which said:

void Update () {
transform.position = new Vector3(0, 0, 20);
}

The GameOver screen appears in front of the background, while it shouldn’t. What is causing this?

Changing Z positions is into the way to build UI’s in Unity.

At least not when using Camera render mode in you Canvas.

In default Canvas renderMode the Z order as you describe it, is simply controlled by the order inside the hierarchy. Try to move background below GameOver screen :slight_smile: