Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Multi-Display Windowed Mode

Discussion in 'Scripting' started by BisuDagger, Sep 6, 2016.

  1. BisuDagger

    BisuDagger

    Joined:
    May 2, 2014
    Posts:
    31
    Hello unity forumers,
    I have a fully functioning multi-display system. When ever it is running, it auto-maximizes the screens on both displays. This causes one major issue because it removes the frame around the player (the frame with the minimize, maximize, and exit button in the top right corner). I need to be able to get that frame back around the main player window and am not sure how to make that possible. If anyone one has a solution or suggestions please share. Thank you!

    StartScreen.png FullScreen.png EndScreen.PNG

    Regards,
    BD
     
  2. BisuDagger

    BisuDagger

    Joined:
    May 2, 2014
    Posts:
    31
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
  4. BisuDagger

    BisuDagger

    Joined:
    May 2, 2014
    Posts:
    31
    Sent a PM with all the code from my display system. If anyone else is interested, then I will share snip-its here.
     
  5. BisuDagger

    BisuDagger

    Joined:
    May 2, 2014
    Posts:
    31
    @karl_jones , An alternative to windowed mode in MD would be to do a reset on the display system so that way display 2 is deactivated again. When I leave the scenarios that require MD I return to the start screen. Is there a way to call a reset on the unity system? What we are trying to avoid is the user having to quit the player in order to have function single display lessons after having completed a MD lesson.

    Hopefully: Display.displays[1].DeActivate(); is added and supported in the future.
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
    I'll reply here to above and your PM so everyone can benefit.

    I noticed you are using renderingWidth/renderingHeight, I fixed a problem with that yesterday. It was returning the system height/width not rendering so this may cause issues if they are not the same.
    I also fixed a bug with getting the mouse cursor not working outside of the main display, this will work in the future once the fix comes out (2~ weeks).

    At the moment it is not possible to disable MD once it is activated, i'll investigate how feasible it is although the MD code is something I have only just started to look into so i'll need to ask one of the other devs.

    I have also noticed that setting the resolution through the Activate function seems to provide better results than using SetParams when starting up.
    As I said i'm still learning this area, i'm in the middle of writing a blog post on it to help provide example etc but it's still early days.

    Karl
     
    viesc123 likes this.
  7. n1ntendo

    n1ntendo

    Joined:
    Feb 9, 2013
    Posts:
    2
    Go @karl_jones ! @BisuDagger gets super excited when you provide help to him and he's KIND OF AN ogre.... so thank you for making him happy and helping him :p
     
    djfunkey and karl_jones like this.
  8. BisuDagger

    BisuDagger

    Joined:
    May 2, 2014
    Posts:
    31
    BisuDagger searches for his beating club.



    @n1ntendo
     
  9. jeroenvdv

    jeroenvdv

    Joined:
    Oct 25, 2010
    Posts:
    52
    Any news on this? I'm looking for the same result as BisuDagger; being able to run windowed on the primary monitor while having one or multiple external monitors in full screen.
     
  10. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
    Hi. No this is not currently supported. We are looking to improve the multiple display system but no eta yet.
     
  11. BisuDagger

    BisuDagger

    Joined:
    May 2, 2014
    Posts:
    31
    @karl_jones thank you for keeping up with this thread. Is there anyway way we can get access to deactivating multidisplay? Returning the screen to single display mode is a necessity for me. Even seeing the hidden code that activates multidisplay would be a huge help. This is putting a halt on a major project of mine and it actually has recently prevented a product from being shipped.
     
  12. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
    Hi,
    At the moment we dont have any built in support for disabling a display once it's activated.
    On windows we use CreateWindowEx. It looks like we do disable the display if we lose the device, maybe there is a way to force it to disable? I dont think its going to be possible to workaround at the moment though.
    I have not tried this but perhaps you could move the display offscreen using SetParams and disable its camera so its inactive?
     
  13. BisuDagger

    BisuDagger

    Joined:
    May 2, 2014
    Posts:
    31
    I actually had a big win this morning after posting here. https://www.assetstore.unity3d.com/en/#!/content/30563
    This unity store asset has a call "Window.Border()" that resets the sim and returns the boarder to the window. It fits perfectly with my case scenario where the user will leave a lesson and return to the start screen anyway. This is a super useful plugin for anyone needing it in the future.
     
    Last edited: Sep 28, 2016
    karl_jones likes this.
  14. evisave

    evisave

    Joined:
    Oct 15, 2013
    Posts:
    2
    Hi,
    same problem here. Is there any solutions currently?
     
  15. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
    Not at the moment (other than running 2 instances of Unity). I suggest you add any feedback, feature request to here http://feedback.unity3d.com/
    We want to improve the multi display support so this will help us put together our roadmap in the future.
     
    evisave likes this.
  16. UNITY3D_TEAM

    UNITY3D_TEAM

    Joined:
    Apr 23, 2012
    Posts:
    720
    ANY UPDATES TILL NOW we havent got deactivate system .added
     
  17. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
    Hi,
    It's not currently on our roadmap. The multiple display system needs a big overhaul before we can start adding new features.
     
  18. nonnicram

    nonnicram

    Joined:
    Apr 3, 2014
    Posts:
    20
    Hi,

    ok, as i understood its not possible to have one screen on "window mode" and the other screen on "fullscreen mode". But is it possible to have both on windowed mode or means several displays always full screen mode?

    Thanks for the info!

    Cheers, Marc
     
  19. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,570
    No when using multiple display they are all full screen. It would be nice to support this in the future but no plans at the moment to do so.
     
  20. nonnicram

    nonnicram

    Joined:
    Apr 3, 2014
    Posts:
    20
    Hey karl_jones,

    actually i found a solution to get multiple displays in "windowed" mode. It works even with one fullscreen and one windowed display. At the end I needed two displays in window mode so i set up three displays on my Computer. In my Unity scene i set up 2 Cameras and subscribed them to display 2 and 3. One of my 3 displays is empty. With this i get two displays in windowed mode.

    In a script on a gameobject is just said:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System;
    4. using UnityEngine.UI;
    5.  
    6. public class DisplayScript : MonoBehaviour
    7. {
    8.     int width = 1730;
    9.     int height = 570;
    10.     int xpos = 130;
    11.     int ypos = 240;
    12.  
    13.     int width2 = 1920;
    14.     int height2 = 1000;
    15.     int xpos2 = 0;
    16.     int ypos2 = 0;
    17.  
    18.     void Awake()
    19.     {
    20.         if (Display.displays.Length > 1)
    21.         {
    22.             Screen.fullScreen = false;
    23.             Display.displays[1].SetParams(width2, height2, xpos2, ypos2);
    24.             Display.displays[1].Activate(width2, height2, 60);
    25.  
    26.         }
    27.         if (Display.displays.Length > 2)
    28.         {
    29.             Screen.fullScreen = false;
    30.             Display.displays[2].SetParams(width, height, xpos, ypos);
    31.             Display.displays[2].Activate(width, height, 60);
    32.  
    33.  
    34.         }
    35.     }
    36. }
    I am on Unity 2018.2.6f1
     
  21. unity_DYSYd8Yxl-YL7w

    unity_DYSYd8Yxl-YL7w

    Joined:
    Aug 7, 2018
    Posts:
    1
    Hi,

    Is it possible to have display[0] windowed and all other displays at fullScreen?
     
  22. nonnicram

    nonnicram

    Joined:
    Apr 3, 2014
    Posts:
    20
    Hey,

    i am not sure, but you can test the code above setting the display[0] to "Screen.fullscreen = true".

    Good luck.
     
  23. ju_my

    ju_my

    Joined:
    Mar 7, 2017
    Posts:
    23
    Hi, any news on this ? It's been 4 years now and still no md improvements?
     
  24. varszegibarnabas

    varszegibarnabas

    Joined:
    Jan 10, 2021
    Posts:
    1
    Im having the same issue here. Any news about md since 2016?
     
    natereesedev likes this.
  25. Barry100

    Barry100

    Joined:
    Nov 12, 2014
    Posts:
    200
    i am also looking to get this working. I need screen 1 to be windowed but screen 2 to be full screen
     
  26. prakyath_unity

    prakyath_unity

    Joined:
    Dec 11, 2020
    Posts:
    9
    Any solution?
     
  27. MatthewNewZealand

    MatthewNewZealand

    Joined:
    Mar 12, 2020
    Posts:
    1
    Any progress on this? I want to run one screen windowed, the other fullscreen.
     
  28. migueel116

    migueel116

    Joined:
    Mar 2, 2023
    Posts:
    1
    Any news about window mode can be used in the Multi-Display? @karl_jones thanks
     
    brunoa_unity likes this.
  29. brunoa_unity

    brunoa_unity

    Joined:
    May 25, 2023
    Posts:
    1
    Has anyone managed to make the X and Y coordinates of the windowed displays work?? It doesn't work here on either 2021.3.25f1 or 2022.3.17f1.
    I have a simple scene in a URP project with 3 cameras assigned to Displays 1/2/3. I run this on my laptop connected to a total of 3 displays and the width/height are respected, but not XY coordinates.

    My script is here:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class DisplayScript : MonoBehaviour
    4. {
    5.     int width = 800;
    6.     int height = 600;
    7.     int xpos = 10; // X and Y don't work!
    8.     int ypos = 20; // X and Y don't work!
    9.  
    10.     int width2 = 640;
    11.     int height2 = 480;
    12.     int xpos2 = 30; // X and Y don't work!
    13.     int ypos2 = 40; // X and Y don't work!
    14.  
    15.     void Awake()
    16.     {
    17.         if (Display.displays.Length > 1)
    18.         {
    19.             Screen.fullScreen = false;
    20.             Display.displays[1].SetParams(width2, height2, xpos2, ypos2);
    21.             Display.displays[1].Activate(width2, height2, 60);
    22.  
    23.         }
    24.         if (Display.displays.Length > 2)
    25.         {
    26.             Screen.fullScreen = false;
    27.             Display.displays[2].SetParams(width, height, xpos, ypos);
    28.             Display.displays[2].Activate(width, height, 60);
    29.         }
    30.     }
    31. }
    32.  
    upload_2024-1-18_15-7-3.png

    In 2022.3.17f1 the API has changed a bit but the results are the same, it still doesn't work:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class DisplayScript : MonoBehaviour
    4. {
    5.     int width = 800;
    6.     int height = 600;
    7.     int xpos = 10; // X and Y don't work!
    8.     int ypos = 20; // X and Y don't work!
    9.  
    10.     int width2 = 640;
    11.     int height2 = 480;
    12.     int xpos2 = 30; // X and Y don't work!
    13.     int ypos2 = 40; // X and Y don't work!
    14.  
    15.     void Awake()
    16.     {
    17.         RefreshRate r = new RefreshRate();
    18.         r.numerator = 60;
    19.         r.denominator = 1;
    20.  
    21.         if (Display.displays.Length > 1)
    22.         {
    23.             Screen.fullScreen = false;
    24.             Display.displays[1].SetParams(width2, height2, xpos2, ypos2);
    25.             Display.displays[1].Activate(width2, height2, r);
    26.  
    27.         }
    28.         if (Display.displays.Length > 2)
    29.         {
    30.             Screen.fullScreen = false;
    31.             Display.displays[2].SetParams(width, height, xpos, ypos);
    32.             Display.displays[2].Activate(width, height, r);
    33.         }
    34.     }
    35. }
    36.  
     
  30. SachinGanesh

    SachinGanesh

    Joined:
    Jun 28, 2015
    Posts:
    21
    Try this
    https://forum.unity.com/threads/mul...ary-displays-workarounds.534641/#post-8752471
     
    brunoa_unity likes this.
  31. Mirrorslav

    Mirrorslav

    Joined:
    Sep 6, 2019
    Posts:
    2
    Any updates? Just being able to deactivate, resize and move the secondary windows would be great.
     
    Napriiihm likes this.