Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Zero-2 · Dec 01, 2014 at 11:41 AM · fullscreenmultiple-monitorsmonitors

Switch Monitor during Runtime

The launcher for a standalone Unity game is able to let the player choose which monitor the game is displayed on. Is there a way I can let the player do this in-game while the game is in fullscreen?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
6
Best Answer

Answer by RuFrozen · Mar 10, 2015 at 01:31 PM

I know voodoo magic:

 PlayerPrefs.SetInt("UnitySelectMonitor", 0); // Select monitor 1
 PlayerPrefs.SetInt("UnitySelectMonitor", 1); // Select monitor 2

Also you need change resolution to appy monitor switch.

Anyway after restart it will select other monitor.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image superdupergc · Aug 06, 2015 at 03:58 AM 1
Share

Confirmed the above worked - but is it possible to query the number of available monitors?

And, more importantly, is it possible to get the full list of resolutions for the current monitor, not just a monitor? Screen.resolutions sometimes returns values for another (the first indexed, but not primary) monitor.

avatar image tscizzlebg · Dec 20, 2019 at 02:37 PM 0
Share

Is there any way to open the game on the desired monitor from the get go? I.e. without having to open the game first, close it, then open it again.

avatar image
2

Answer by lodendsg · Feb 01, 2016 at 05:43 PM

Ran into this one my self and found this post first then stumbled upon the following in the Unity docs

http://docs.unity3d.com/ScriptReference/Display.Activate.html

Display.Activate(); seems like the ideal option, the Display class contains additional handy members such as displays which lists the connected displays e.g. a means to get at the resolution.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image TheMasonX · May 13, 2016 at 09:29 AM 0
Share

Can't comment directly on @lodendsg's answer, but Display doesn't seem to really work for this (at least in any way I could tell). Calling Activate() creates another window (leading to two) rather than switching monitors, as it's designed for multiple displays at once, rather than switching.

To anyone wanting to get the native resolution of the specific monitor you're switching to rather than the generalized Screen.resolutions (as @superdupergc requested), you can actually use the Display.displays info for this. How I implemented it:

 public void Set$$anonymous$$onitorIndex (int new$$anonymous$$onitorIndex)
 {
     PlayerPrefs.SetInt("UnitySelect$$anonymous$$onitor", new$$anonymous$$onitorIndex);
 
     var display = Display.displays[new$$anonymous$$onitorIndex];
     int resWidth = display.systemWidth;
     int resHeight = display.systemHeight;
     Screen.SetResolution(resWidth, resHeight, Screen.fullScreen);
 }
avatar image XenonSpher TheMasonX · Jun 29, 2016 at 03:29 AM 0
Share

hey how can you Screen.SetResolution the 2nd monitor?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Fullscreen on a second (non primary) monitor 1 Answer

My multi-monitor support is broken. How can I fix this? 2 Answers

Fullscreen on non-primary monitor in OS X 0 Answers

Borderless window in standalone player 5 Answers

Rendering a single fullscreen window across multiple monitors 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges