3D objects appear behind 2D on mobile, but in correct order in editor
Hello and thanks in advance!
I have a game with both 2D and 3D elements in it. I have used the Z axis to stagger them so that they appear in a certain order in my orthographic camera. Everything appears correctly when I play the game in the editor, but when I load it on my Android device the 3D objects (the characters) appear behind all the other 2D elements (UI and scene).
Also this was working correctly until recently... I haven't upgrade anything so I'm hoping it's just a setting I accidentally set somewhere.
EDITOR
ANDROID
Hi xxmariofer, the sprites and other 2D elements are all appearing in the correct order. The characters which are 3D models are appearing behind all the 2D elements on mobile, though they appear fine when I run the game in the editor.
What sorting layer are you using with your sprites? Do you have moee than one? All renderers even the 3d ones have this property that manahe whats behind/infront
Are your 2D srpites on UI ? How is your canvas appearing : screen overlay or camera overlay ?
Saryk360 the scenery (mountains, ground, clouds) are not on a canvas. They are just a Sprite Renderer attached to an otherwise empty game object. And I've staggered those objects along the Z axis so they appear in a certain order. The stats for the characters are UI elements on a Canvas of type World Space and are children of the character so they move with them. All of the UI and Sprites render in the proper order except for the 3D models themselves which appear behind everything else.
Have you made certain that they appear at all and that it is a rendering order issue ?
Answer by SlyTrip · Jun 11, 2019 at 04:07 PM
Thanks for all the great suggestions everyone. I tried them all, but the problem still persists. My guess is that the issue is somehow related to quality or graphics settings for Android. Like I mentioned the sorting works exactly as expected when I run the game within Unity. It's only when I install it on the Android device that it behaves differently. I'm still pursuing a possible solution, but if anybody else has any ideas please let me know, thanks!
Your answer
Follow this Question
Related Questions
How do I get the current active camera? 2 Answers
Using two cameras to blend regular 2D orthographic with 3D isometric orthographic elements 0 Answers
i need to switch between two cameras but dont know how 1 Answer
how put 3d object in front of android camera? 0 Answers
Camera and UI settings for aspect ratio independent 2D game 1 Answer