Search Unity

Multiple displays

Discussion in 'Editor & General Support' started by pbourke, Aug 12, 2008.

  1. pbourke

    pbourke

    Joined:
    Dec 27, 2007
    Posts:
    32
    I'm creating an exhibit for a museum using Unity. Ideally what I would like to do is have the "game" running on one display (will actually be projected at SXGA+ resolution) and a touch panel/display running/displaying the gui elements. The touch screen will be a different resolution than the game screen. I've tested the hardware and no problems. Is there a way of doing this in Unity, not obvious to me that there is at the moment?

    [ps: Cross posting this in the gui forum also.]
     
  2. Alec

    Alec

    Joined:
    Mar 11, 2008
    Posts:
    1,330
    Hmmm, I'm not sure how that could work. Nice to see another Australian anyway... ;)
     
  3. TJB

    TJB

    Joined:
    Mar 20, 2007
    Posts:
    146
    What i'd do is have a separate executable for each monitor. Let me explain a little more.

    First problem is you need them to interact. You could have the program the user interacts with write to a text document. For instance if the player clicks one button it writes a "c", if the player clicks a different button it write a "h". The second app then reads this text document and clears it when it's done reading it.
    For this you can find info here:
    http://forum.unity3d.com/viewtopic.php?t=9467

    The second problem is maximizing both applications on separate screens. I tested doing this and it worked on my mac with my second display at a different resolution. What I did was wrote 1 line of code saying:
    if(Time.time >= 10) Screen.fullScreen = true;

    So how this works is I duplicated my program and opened the 2 apps as windowed versions. I then dragged one app to screen 1 and 1 app to screen 2. After ten seconds of being opened each app maximized to the screen it was on.

    For this to work make sure you check off:
    Edit -> Project Settings -> Player -> Capture Single Screen
    If you don't the first app to maximize will black out the second screen.

    Also check off:
    Edit -> Project Settings -> Player -> Run in Background

    There might be problems maximizing 2 apps in microsoft windows... if so i'd try to see if there's a way to zoom in on either of the monitors and only maximize 1 (like you can on most data projectors). It wouldn't be a pixel perfect solution, but it might work sufficiently.


    I haven't tested this out in it's entirety, just the maximizing two screens part, but i think everything else should work without too much problem.

    Let me know how it goes :)
     
  4. cecarlsen

    cecarlsen

    Joined:
    Jun 30, 2006
    Posts:
    864
  5. dorneo

    dorneo

    Joined:
    Dec 1, 2008
    Posts:
    4
    we have exactly the same problem here.
    first we used a matroxtripple head für both, the projector and the touchsreen, then we calibrated the touchscreen and controlled the mouse with an offset, but it was not really as precise as we wanted it, so mabye the next approach is the one TJB described.

    cheers
    d
     
  6. alphasuede

    alphasuede

    Joined:
    Sep 2, 2009
    Posts:
    4
    Maximize to second display.

    I noticed that the delayed full screen solution does not work on windows.

    Tested on XP w/ Unity pro 2.6.0

    Anyone have a solution that works for windows?
     
  7. dhill

    dhill

    Joined:
    Mar 29, 2009
    Posts:
    15
    We're trying to run full screen on one monitor under Vista, and have another program run on a second screen. Actually it's worse than that. We're trying to use the IZ3D stereoscopic driver to put left and right eye images on two projectors, and a touch screen on a third.

    We haven't had any success with a timer that maximizes Unity. Both games maximize to the same screen. In any case, when we click on a second application, the fullscreen Unity game minimizes.

    Has anyone had success under Vista or Windows 7 in having Unity maximized while having mouse, keyboard or touch interaction with a different application running on the same machine? We're using a 3DConnexion SpaceNavigator to move around in Unity, so we don't need mouse or keyboard there.
     
  8. alphasuede

    alphasuede

    Joined:
    Sep 2, 2009
    Posts:
    4
  9. AIResearcher

    AIResearcher

    Joined:
    Aug 23, 2010
    Posts:
    39
    I've been trying to get multiple monitors working on Mac OSX for a while.

    It seems that if I launch the "configuration" panel and move it, it will full-screen to the monitor it is on. However, if I skip past the "configuration" panel, even in a windows mode, no matter which screen I move the monitor to, it will only full-screen in my primary monitor.

    Once the application has opened (before even any script calls) it has decided for the run of the application which monitor to full-screen in.

    If I could get your way working, being able to use a timer, it would be much better for me. It could be that the new version of Unity (I'm using 3.0) broke this timing ability, but I'm hoping it's more of a setting thing.

    As for windows, I noticed there's a command-line option -adapterN which will allow one to launch in another window automatically.
     
  10. JRavey

    JRavey

    Joined:
    May 12, 2009
    Posts:
    2,377
    I wrote something like this, but it is two distinct apps. One runs the GUI and telemetry display while the other runs the simulation. You could write the GUI in an language you want since packets are packets.
     
  11. AIResearcher

    AIResearcher

    Joined:
    Aug 23, 2010
    Posts:
    39
    Do you mean that the GUI is not written using Unity? I understand the concept of using one Unity instance per each monitor, but am trying to automate the choosing of which monitor each instance runs in.
     
  12. Hannebaum

    Hannebaum

    Joined:
    Nov 4, 2009
    Posts:
    11
    You can run unity in a web browser component on one form and open another form required for you GUI maximized on another screen. This is all still one Visual Studio application. There is a good Screen class available from within Visual Studio.

    Here are three good references for you:
    Web Player browser communication - http://unity3d.com/support/documentation/Manual/Unity%20Web%20Player%20and%20browser%20communication.html
    Visual Studio to JavaScript(browser) communication - http://www.codeproject.com/KB/vb/vb_jscript_communication.aspx
    Muti-monitor programming - http://www.codeproject.com/KB/cs/multi-monitor_in_c_.aspx

    This should be enough to get you going.
    Good luck
     
  13. AIResearcher

    AIResearcher

    Joined:
    Aug 23, 2010
    Posts:
    39
    Wow! Thanks for such great responses. It's great to be a part of the Unity community.

    I'm developing on Mac OSX. I think the web app is a good idea for some. There are some very easy ways to embed the web player into a Cocoa app. However, we've noticed that the web player doesn't give us the response time and frame rate the stand alone player does.

    I use the NSScreen class to find what monitors are around and where they are, and I can use the NSWindow class to get the top-level window and move it around. However, no matter where I move the window (using whether using code or the mouse itself), once I open up the application it is locked to using that full screen.

    So when the application opens (even if it has never been full screened) on the primary monitor (which it does by default and there's no OSX hooks to open it on another screen first...) and I move it to the second monitor, as soon as it is full screened it reverts back to the primary monitor.

    The only path ahead that I can think of is to always open with the configuration dialog, then use an apple script to move the configuration dialog to the correct monitor and set the options and play. However, there are so many ways this could go wrong.

    Windows has a nice feature which will launch any application on any monitor, allowing you to set the window size and resolution.

    I've also tried to figure out if Mac somehow stores information on where the application was last opened, thinking I could edit this information then launch it, but it doesn't even seem to remember and relaunch in the same location...

    IIt would be nice if we could get the -adapterN support for Mac OSX. Or better yet, fix the full-screen launch so that it checks which display it is located on and opens in that screen.
     
  14. Mnollock

    Mnollock

    Joined:
    Dec 9, 2008
    Posts:
    26
    Hi, just to throw my input in. We have a 3 screen setup at work. We Use the Matrox Triple Head-to-go. Also currently building a 2 screen (1 projector, 1 touchscreen) setup for a client. I am going to manage this by having two cameras looking at separate areas of the "game" area, then using the normalised viewing area, to "split" this screen. We do have to keep the resolution the same on both, but if we optimise both screens to the higher of the two resolutions, we get the resolution we want on the larger screen, and a much crisper image on the smaller one.