4.6 UI - Render 2D image depth like 3D Image

Here is what I am trying to do:

Have a canvas rendered as a screen overlay with a button / image on it following a GameObject in 3D space. That part is easy with WorldToScreenPoint.

The problem I am facing is I would like the 2D Image to be depth tested like if it was 3D. So if there is an object in front of the image it does not render, if it is half covering you can see half of it. If the image is in front of the object it renders fully.

Separate cameras did not work as it would only render in front or only behind.

Making the Image a billboard in a world space UI kinda works but I had the problems:
past rotating the camera 90 up the billboard flips
Size on screen changed with distance

Code I’m using for the billboard:

class LookAt : MonoBehaviour
    void Update()
        transform.up = (Camera.main.transform.position - transform.position);
        transform.forward = Camera.main.transform.forward;

using transform.lookat causes them to spin around past rotating the camera 90

I’m curious if anyone has a solution to either the 2D or 3D


Use Screen space Camera and set the camera as your main camera