Hello,
I’ve got two canvases in a scene.
A camera looks at each of the two canvases.
In the code I have activated a second display.
I want one canvas in the compiled application to appear on the main screen and the other canvas on the second screen. The two screens have a different resolution.
In the Gameview of the Unity Editor everything works fine.
The problem now is that after compiling, the second screen takes over the resolution of the first screen and is therefore displayed incorrectly.
I compile the application with the player setting Fullscreen Windowed.
If I don’t activate the second screen in the code, I have the possibility to switch back and forth between fullscreen and windowed with alt+Enter and thus adjust the size.
If I activate the second screen in the code, I can no longer use the alt+Enter shortcut.
I tried different screen and display settings in the code and in the Unity editor but nothing led to success.
Here is the code I run on startup
void Start()
{
//Effects only the Main Screen
Screen.SetResolution(2160, 3840, false);
if (Display.displays.Length > 1)
{
Display.displays[1].Activate(1920, 1080, 60); // Has no effect
}
}
In Unity I assigned the two canvases to the render mode Screen Space - Overlay.
I use the Unity version 2019.2.2f1.
I’ve been looking for a solution for two days and seemingly just can’t find one. If someone could give me a hint, that would be great.