Author Topic: Force interface to middle monitor in 3 monitor setup  (Read 2414 times)

alan.lawrance

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Force interface to middle monitor in 3 monitor setup
« on: December 08, 2014, 10:26:58 AM »
We would like to force all the interface elements to be on the center monitor in a three monitor setup.

If the game is running at 5760x1080 (3 1920x1080 monitors), the interface spreads out (as it should, as NGUI is just handling things properly from a resolution independent POV).

Is there a way to "trick" NGUI into thinking the interface should be displayed using 1920x1080 with the top-left pixel being (1921,0), when the "real" resolution is 5760x1080?

That would ensure all the interface stays centered on the center monitor, which is what we want in our case.


Ferazel

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 150
    • View Profile
Re: Force interface to middle monitor in 3 monitor setup
« Reply #1 on: December 09, 2014, 03:30:05 AM »
I recently worked on a problem similar so I might be able to help.

The solution I came up with is to move/adjust the viewport of Camera component that the UICamera uses. So if you support 16x9 as the widest aspect ratio and you have a constrained height you can determine what the camera's viewport should be based on the current Screen.width compared to the max UI width (Screen.height * (16/9)) to get the viewport percentages that you can input into the viewport rect on the Camera component.

Hope that helps!

nkls

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: Force interface to middle monitor in 3 monitor setup
« Reply #2 on: December 09, 2014, 04:42:29 AM »
We did this in a recent project. With this simple line of code:
iUICamera.rect = new Rect(1 / 3.0f, 0, 1 / 3.0f, 1);