Page 1 of 1

Can't have Screen Depth with Android build settings ?

PostPosted: Fri Mar 08, 2019 1:29 pm
by donpinkman
Hello,
I am trying to get a simple screen depth ( screen position, connected to screen depth, connected to debug). It works fine when it's on windows platform (on the build setting).
But as soon as I switch to Android it's not working anymore....Any clue why ?

Thx

Re: Can't have Screen Depth with Android build settings ?

PostPosted: Fri Mar 08, 2019 5:27 pm
by Amplify_Borba
Hello, thank you for getting in touch and for your support!

There are known to be differences between target platforms, including when it comes to the depth calculation, which is the case.

In this specific situation, adding the following script to the camera will have it behave in the Android platform the same way as in the Windows platform:

Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[ExecuteInEditMode]
public class CameraSetup : MonoBehaviour
{
    private void Awake()
    {
        GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
    }
}


Please let me know if this helps, thanks!