Search Unity

Sprite and mesh render order different on Android

Discussion in 'Editor & General Support' started by speedybyte, Jun 11, 2021.

  1. speedybyte

    speedybyte

    Joined:
    Jun 11, 2021
    Posts:
    4
    Hey there! I’m currently developing a game with Unity and ran into a problem while building for Android. The game is 3D (the player, obstacles, etc.), but I used 2D sprites for certain things, for example the ground that the objects are placed on.
    On iOS as well as in the Unity player, the 2D sprites and 3D mesh renderers are correctly rendered within the scene, according to their relative distances from the camera.
    However, on Android, they are rendered in the wrong order. The sprites are rendered above all the mesh renderers.
    What is the cause of this? Why does it only happen on Android?

    I know that it is not caused by camera clipping, as the mesh renderers become visible when they move to a spot where there is no sprite “blocking” them off.
    Unity version is 2017.3.1f1.

    I would really appreciate any responses, especially suggestions on how I could fix this.
    Thank you!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
  3. speedybyte

    speedybyte

    Joined:
    Jun 11, 2021
    Posts:
    4
    Thank you for the quick response!

    It turned out that it was caused by the render queue values of the materials I used. The render queue value for the sprite material was set to 3000, while the 3D object materials were at 2000. Setting the render queue value of the sprite material to 1000 solved my problem.
    No idea why it only shows up on Android, though.
     
    Last edited: Jun 11, 2021