- Home /
Getting Unity to render across multiple monitors
At the moment I am trying to get unity to run across 2 monitors. I've done some research and know that this is, strictly, possible. There is a workaround where you basically have to fluff your window size in order to get unity to render across both monitors.
What I've done is create a new custom screen resolution that takes in the width of both of my monitors, as seen in the following image, its the 3840 x 1080:
How ever, when I go to run my unity game exe that size isn't available. All I get is the following:
My custom size should be at the very bottom, but isn't. Is there something I haven't done, or missed, that will get unity to take in my custom screen size when it comes to running my game through its exe?
Oddly enough, inside the unity editor, my custom screen size is picked up and I can have it set to that in my game window:
Is there something that I have forgotten to do when I build and run the game from the file menu? Has someone ever beaten this issue before?
Have you checked the Player Settings under File->Build Settings, and see if there are tick marks in all boxes under "Supported Aspect Ratios"? Perhaps it's skipping the custom one because its aspect ratio doesn't match any of the standard monitor ratios. I guess the checkbox labelled "Others" would include it, then.
I have. Everything is checked under "supported aspect rations" and was one of the first port of calls I made. Thank you though.
That's why I didn't post it as an answer. ;) I had a feeling you probably looked there already.
I'm out of ideas insofar as the builtin resolution dialog is concerned, then. To be honest, I think it could do with a bit of a rewrite/extension to include some more customizability in the editor. I think you're going to have to either write your own resolution dialog in-game, or set the resolution manually yourself using Screen.SetResolution, see http://docs.unity3d.com/Documentation/ScriptReference/Screen.SetResolution.html
can anyone tell me how to use this script
Screen.SetResolution(width, height, false);
to change my 2nd Display Screen? not my default main Screen
I don't know how to call the 2nd Display screen. I just wanna change it. cause every time i use that script it changes the main screen not the 2nd screen.
Answer by betabob · Jul 09, 2013 at 03:05 AM
OK, so I played around with this a bit and figured out a solution that works (not sure if it's a good final solution, but it does what it's supposed to do.
In 'Player Settings' set your default Resolution to (in your case) 3840 and 1080. Then, and this is the key(!), set 'Display Resolution Dialog' to 'Hidden By Default' and make sure 'Default Is Full Screen' is NOT checked. This way it will not ask for the resolution (which won't have the custom one you want) and set it automatically to the resolution you set at (in the following script).
Next, create an empty game object (or place this script where you feel it fits best):
void Start () {
Screen.SetResolution(3840, 1080, false);
}
Basically, if you allow it set the resolution via the startup screen or tell it to use full screen it restricts the view to a single monitor. If you tell it what resolution you want and allow it to run in windowed mode it will stretch across both monitors.
In my case I have two monitors and just got the Oculus Rift DevKit today. My first monitor has 2 cameras which are duplicated onto the Rift headset and my second monitor has a single camera. This way I can have one player use the headset and a second player play on the other monitor using mouse and keyboard. This could easily be expanded by setting up a Hydra controller for the player using the Rift.
I hope this works for you!
ps: If someone figures out to get a true full screen across two monitors that would be even better!
And another update:
http://docs.unity3d.com/Documentation/$$anonymous$$anual/CommandLineArguments.html
You can use Command Line arguments to get rid of the borders to create a seamless fake full-screen. It's still windowed, but has no borders.
To do this (in windows):
1) Create your build.
2) Create a shortcut (where ever you want) that is directed to your build. For example: "C:\YourBuild\myGame.exe"
3) Go into the shortcut properties and in the Shortcut tab in the Target section write: "C:\YourBuild\myGame.exe" -popupwindow
4) Run your shortcut and you now have the game running across two windows without any borders (fake full screen)!
Answer by m-poyade · Sep 08, 2014 at 09:58 AM
Hi All,
I wanted to display my Unity project through my extended desktop running onto two monitors.
To do so, I have followed the previous advice, I have included in my code:
Screen.SetResolution(3840, 1080, false);
and set the following options in my PlayerSettings:
Resolution: Default is Full Screen: Unchecked. Default is Native Resolution: Unchecked. Default Width: I have written my desired width (3840), but it does not seem to matter as the setResolution() method seems to overwrite it. Default Height: Same as above.
Standalone Player Options I have disabled the "Display Resolution Dialog" I left the rest as it was.
Then I built and ran my project. The outcomes appeared shared between my both screens but in a window. To get rid of the window, I ran my project from the console using as:
C:\myProject.exe -popupwindow
As a result, I have the project running on my whole extended desktop. This is very useful for passive stereo systems using two projectors.
Regards
Matt.
Answer by Romejanic · Sep 14, 2015 at 10:34 AM
From what I can understand, you use the Display class to do it.
Your answer
Follow this Question
Related Questions
CustomPropertyDrawer can't restrict multi editing 1 Answer
Can Unity Open a second game window? 0 Answers
Multiple editor windows combined 0 Answers
Camera rendering only what is in its view 1 Answer
Transparency shader problem 5 Answers