Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Start the game always on the main display

Discussion in 'Editor & General Support' started by adam_mehman, Aug 18, 2016.

  1. adam_mehman

    adam_mehman

    Joined:
    Dec 11, 2014
    Posts:
    104
    Hi guys, I am unable to find the solution or setting how to set the display which will be used for playing the game.

    For example, user/player have 3 displays and I want that my game always opens up on the main display.

    But I dont want to use the Unity builtin pregame dialog.

    Thank you
     
    ViacheslavRud likes this.
  2. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    Do you mean you want to set the opening scene when your game launches? To do that open Build Settings. Add the scenes you want to the Scenes in Build section. Drag the scenes into the order you want. The game will open with Scene 0.
     
  3. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    No, OP means the primary screen when using multiple monitors.







    I'd have to check how to solve it exactly, I think I'd look here:

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

    edit:

    Found 2 Answers

    http://answers.unity3d.com/questions/1131106/possible-to-change-display-and-update-resolutions.html
    http://answers.unity3d.com/questions/844193/switch-monitor-during-runtime.html
     
    Last edited: Aug 18, 2016
  4. adam_mehman

    adam_mehman

    Joined:
    Dec 11, 2014
    Posts:
    104

    Yes, I meant this. I will check this out and get back to you. Thank you.
     
  5. Volchok

    Volchok

    Joined:
    Jul 26, 2017
    Posts:
    127
    Hi guys!

    Unity 2020.1.14f1

    I have 5 monitors. I would like my game run in fullscreen only in main monitor.

    I set code in Start():

    Code (csharp):
    1.  
    2. if (Display.displays.Length > 1) {
    3.        Display.displays[1].Activate();
    4. }
    5.  
    Everything is all right, but my left monitor (number 3) is always black and the cursor is moving in it (the duplication of movements). ))

    What should I do to get rid of this error? Thank you!





     
  6. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
    I just came across the same thing with a Unity 2021.3.2f1 app (was created with an older version):
    I've got a 3 monitor setup (1 - 3 - 2) and the middle one is set as my main monitor in Win 10's settings. Whenever I open the exported Windows app (Fullscreen Window), it automatically opens on the right monitor though, even if I double-clicked the *.exe file on the main or left one.
    With the "Display Resolution Dialog" that let you pick the monitor now deprecated, is there a way to fix this?
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,504
    See https://forum.unity.com/threads/how-to-get-game-build-to-run-on-main-display.1273394/
     
  8. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,504
    No, we have the fix but just trying to merge and ship it.
     
    Volchok likes this.