playMaker

Author Topic: Dual monitor 2 player - A camera for each monitor?  (Read 1654 times)

daniellogin

  • Full Member
  • ***
  • Posts: 215
Dual monitor 2 player - A camera for each monitor?
« on: April 24, 2019, 03:09:32 AM »
I have two monitors hooked up on this computer. I'm playing around making a 3rd person game and considering adding 2 players. I hate split screen though, so don't think I will bother unless I can get it so each player has their own monitor.

So just to be clear, I want to use two monitors, but I don't want it to be spanned across both monitors. I know how to do that with Nvidia and it's easy, but what I want to do is have a camera for each player, and each camera plays full screen on it's own monitor.

How?

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: Dual monitor 2 player - A camera for each monitor?
« Reply #1 on: April 24, 2019, 06:47:40 AM »
Ok I did a quick test with this script I found and it seems to work:

Code: [Select]
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class multi_display : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        Debug.Log("displays connected: " + Display.displays.Length);
        // Display.displays[0] is the primary, default display and is always ON.
        // Check if additional displays are available and activate each.
        if (Display.displays.Length > 1)
            Display.displays[1].Activate();
        if (Display.displays.Length > 2)
            Display.displays[2].Activate();       
    }
    // Update is called once per frame
    void Update()
    {

    }
}

That script enables up to 2 screens.. or is it 3? I dunno. It checks how many it needs though.

Using that and setting the first camera to Display 1 and the other to Display 2 works, but only in the build, not in the preview.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Dual monitor 2 player - A camera for each monitor?
« Reply #2 on: April 25, 2019, 05:34:08 AM »
Hi.
Thanks for sharing this!

i actually can use this in one of my arcade projects!

I will make a PlayMaker action/version of this.

i also did some research and indeed this can only work in a build.

But you can see the different displays by selecting them (top left game window)

i also found this unity post :
https://answers.unity.com/questions/1131106/possible-to-change-display-and-update-resolutions.html

So maybe i can make an action to make it possible to swap display @ runtime
by (for example) pressing a button.

pls bump if i did not reply with some actions by next week :)

daniellogin

  • Full Member
  • ***
  • Posts: 215
Re: Dual monitor 2 player - A camera for each monitor?
« Reply #3 on: May 05, 2019, 12:55:08 AM »
pls bump if i did not reply with some actions by next week :)

Bumped, if you are still interested in making some actions.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Dual monitor 2 player - A camera for each monitor?
« Reply #4 on: May 11, 2019, 11:37:25 AM »
Hi.
Sorry i had a hectic week, i will try to make them this week.