- Home /
Window is minimizing when I click other screen in dual monitor.
Is it possible to do some tasks during in full screen unity app? I mean like below
Screen1: running unity's some app.exe in fullscreen Screen2: do something, ie. web browsing, seeing log and so on.
I could launch app in fullscreen, but when I do something on Screen2, Screen1's app switch to min window mode. So in unity's current specification, it's impossible to do something in other window?
environment
Unity pro 4.3.2f1
Win 8
Answer by Kolodej · Jan 14, 2014 at 04:08 PM
Hi, the answer is no. But you can start your app in window mode, without border, set the position and resolution to fit the target monitor (enable run in background player property). I have used this many times.
You can do this via Windows Native Methods, you can send messages to window handle to set position, size and other properties. See code below.
Note: I am using external (controller) application to do this.
/// <summary>
/// Changes the size, position, and Z order of a child, pop-up, or top-level window. These windows
/// are ordered according to their appearance on the screen.
/// The topmost window receives the highest rank and is the first window in the Z order.
/// </summary>
/// <param name="hWnd">A handle to the window.</param>
/// <param name="handle">A handle to the window to precede the positioned window in the Z order.</param>
/// <param name="x">The new position of the left side of the window, in client coordinates.</param>
/// <param name="y">The new position of the top of the window, in client coordinates.</param>
/// <param name="cx">The new width of the window, in pixels.</param>
/// <param name="cy">The new height of the window, in pixels.</param>
/// <param name="flags">The window sizing and positioning flags.</param>
/// <returns>
/// If the function succeeds, the return value is nonzero.
/// If the function fails, the return value is zero. To get extended error information, call GetLastError.
/// </returns>
public static bool SetWindowPos(IntPtr hWnd, SetWindowPosHandle handle, int x, int y, int cx, int cy, SetWindowPosFlag flags) {
return SetWindowPos(hWnd, handle.Handle, x, y, cx, cy, (uint)flags);
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
Hi $$anonymous$$oldej, Oh, I see.. But why does the performance go down? Does Unity app switch graphical mode when changing to fullscreen? Am i right?
Hi, when is the app in fullscreen mode, then the graphic card is dedicated only to the app. When you are in window mode, then the others windows/apps are rendered => graphical context switching. The performance goes down, its true, but it is not so serious, if your app is not ultra modern hi tech, you can have still 60FPS :) Everything depends on what do you wan to do and why.
I am having this same problem. I had already looked at the option of using a borderless window and I think that would work but I don't know how to size and place the window. How can I move the window to the second monitor and resize it to the monitor's current resolution programmatically?
Thanks...
Your answer
Follow this Question
Related Questions
Conditional compilation for Windows 8? 1 Answer
Continuing problems with windows 8.1 0 Answers
Upgrade from Windows 8 to 8.1 killed my Unity editor 1 Answer
File access in Windows 8? 2 Answers