Can't have Screen Depth with Android build settings ?

Node-based Shader Editor
Post Reply
donpinkman
Posts: 1
Joined: Fri Mar 08, 2019 1:25 pm

Can't have Screen Depth with Android build settings ?

Post 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
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

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

Post 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!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply