Hello there Unity Answers! I’m currently working on a project here at work and could use some help. I’m attempting to render a single fullscreen window across multiple displays and after a bit of trial and error I stumbled upon an odd quirk which seems to have achieved just that.
I’m afraid I can’t share my local project but below are the steps to reproduce this behavior.
-
Create a new empty Unity3D project
-
Create a new component and add
somewhere in your scene. Make it run
the following code during Start()Screen.SetResolution( SCREEN_WIDTH, SCREEN_HEIGHT, false );
Display.displays[0].Activate(); -
Replace SCREEN_WIDTH and SCREEN_HEIGHT with values as appropriate. Setting these values to something smaller than your target screen creates a borderless window centered in the middle of your display. Setting them to the same height, but a larger width will create a window which draws fullscreen and onto the next display. Setting the width equal to both displays and the height as your display’s height results in a fullscreen window drawing across both displays.
-
Build and run, and admire your new fullscreen window
I’ve read through the documentation but haven’t been able find anything which explains this behavior. Does anyone here know how this is working? It only seems to apply to the 0th display, as sending a different camera to the 3rd screen and calling Display.Activate() on it renders a fullscreen window which fills only that display instead of my provided window dimensions. Setting the screen dimensions from within Display.Activate() didn’t have the same results either and attempts to duplicate this behavior onto a third and fourth monitor have so far proven unsuccessful.
I’m running on Windows and have tested this effect in both Unity 5.4 and Unity 5.5. This question has also been crossposted to the /r/Unity3D community and can be found here