Unity transparent fullscreen with multiple screens

1

I've found this: https://github.com/pheonise/Unity3D-Desktop-Overlay

Basically, it's about having a transparent fullscreen window made in Unity. It works perfectly but I really want to have this over multiple screens. When I try to do this, the background isn't transparent anymore.

In my first attempt, I made a second camera with the script below attached. This was not working. Then I tried to attach the transparency script to the second camera but even then both the main screen had a white background and the second had a black background. I'm pretty sure it has to do with the window handler. In the transparency scripts the fullscreen window starts with the following handler properties:

const int GWL_STYLE = -16;
const uint WS_POPUP = 0x80000000;
const uint WS_VISIBLE = 0x10000000;
const int HWND_TOPMOST = -1;

I can't figure out how to apply those to the second fullscreen window.

Camera[] myCams = new Camera[3];

void Start()
{
    //Get Main Camera
    myCams[0] = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();

    //Find All other Cameras
    myCams[1] = GameObject.Find("Camera2").GetComponent<Camera>();
    myCams[2] = GameObject.Find("Camera3").GetComponent<Camera>();


    //Call function when new display is connected
    Display.onDisplaysUpdated += OnDisplaysUpdated;

    //Map each Camera to a Display
    mapCameraToDisplay();
}

void mapCameraToDisplay()
{
    //Loop over Connected Displays
    for (int i = 0; i < Display.displays.Length; i++)
    {
        myCams[i].targetDisplay = i; //Set the Display in which to render the camera to
        Display.displays[i].Activate(); //Enable the display
    }
}

void OnDisplaysUpdated()
{
    Debug.Log("New Display Connected. Show Display Option Menu....");
}
c#
unity3d
user32
asked on Stack Overflow Aug 20, 2019 by RomanTenger • edited Aug 20, 2019 by Iggy

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0