how to set borderless fullscreen always on topmost?
Hi,
I need to switch between windowed and borderless fullscreen of a windows standalone build, so I used Screen.SetResolution
and it worked. but I also need the fullscreen always on topmost so that other windows wouldn't occlude the game.
So I tried to use Native win32 api to find the game window and set it to topmost by
[DllImport("User32.dll", EntryPoint = "SetWindowPos")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("User32.dll", EntryPoint = "FindWindowA")]
static extern IntPtr FindWindow(string className, string windowName);
and it works in the editor when I have a file browser window with the same title as my game. but when I build the player, it stopped work with either file browser window or my game window.
if someone have experience or know how I might be wrong, please help!
Thanks,
Alex
Your answer
![](https://koobas.hobune.stream/wayback/20220612214702im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I pushed some button now my game only shows in window mode 0 Answers
Make game start fullscreen without launcher? 0 Answers
Equivalent of "Mac Fullscreen Mode: Fullscreen Window" for Windows users? 2 Answers
Failed to Initialize 3D Graphics? 10 Answers
Game Started on Windows, trying to get an iOS version -- terrain was deleted 1 Answer