Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: alan.lawrance 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.
-
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!
-
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);