Can't have Screen Depth with Android build settings ?

Node-based Shader Editor

Can't have Screen Depth with Android build settings ?

Postby donpinkman » Fri Mar 08, 2019 1:29 pm

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
donpinkman
 
Posts: 1
Joined: Fri Mar 08, 2019 1:25 pm

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

Postby Amplify_Borba » Fri Mar 08, 2019 5:27 pm

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


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 9 guests