2
\$\begingroup\$

I’m currently developing a game with Unity and ran into a problem while building for Android.

The player and obstacles are mesh renderers (for example cubes & boxes). On iOS and the Unity editor, when a cube collides with a box, they intersect, they go "inside each other", which is what I want to happen.

On Android, however, one is drawn on top of the other, there is no intersection. When the cube moves through more than half of the box, the box is drawn on top of the cube. screenshot

What is the cause of this? Why does it only happen on Android?

These are my camera settings: screenshot

I would really appreciate any responses, especially suggestions on how I could fix this. Unity version is 2017.3.1f1. Thank you!

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Can you show us a screenshot of what it looks like in the Unity player vs what it looks like on Android? This sounds like a depth map precision issue, but we'd need to see the symptoms to have a better idea. \$\endgroup\$
    – DMGregory
    Commented Jun 12, 2021 at 9:59
  • \$\begingroup\$ @DMGregory Thank you for your response, I added a screenshot to my original question. \$\endgroup\$
    – azulbocu
    Commented Jun 12, 2021 at 16:59
  • \$\begingroup\$ Can you show us what material and settings you're using on these cubes, as well as the configuration of your camera component? Try bringing your camera's near and far plane values closer together to see if that makes any difference. \$\endgroup\$
    – DMGregory
    Commented Jun 12, 2021 at 18:15
  • \$\begingroup\$ @DMGregory I added the camera configuration to the post. I tried materials with all kinds of different shaders. Let me know if you need more info! \$\endgroup\$
    – azulbocu
    Commented Jun 12, 2021 at 20:24
  • 1
    \$\begingroup\$ @DMGregory The far plane was at 1200 before, but you said to put them closer together. Anyways, I finally got it to work! Setting the rendering path to "Deferred" did the trick, thank you for guiding me to the camera configuration! Do you know what this setting means? I am getting a warning about MSAA now, do you know anything about that? Thank you again. \$\endgroup\$
    – azulbocu
    Commented Jun 12, 2021 at 20:42

1 Answer 1

0
\$\begingroup\$

Setting the rendering path to "Deferred" solved the issue.

\$\endgroup\$
1
  • \$\begingroup\$ It says Deferred Shading requires GPU support (docs.unity3d.com/Manual/RenderingPaths.html). Does this rule out lots of Android phones as potential targets for your app? Is this the only way to solve this problem I wonder. Also seems to rule out semi-transparent objects. \$\endgroup\$ Commented Jun 12, 2021 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .