- Home /
Windows Player Behavior
Hello.
I need to customize my window's size, location, and style based on parameters in an .ini file on Windows. So far I've written a "WindowManger.cs" script with hooks into the required Win32 functions (SetWindowLong, SetWindowPos, etc.). The Awake() function reads from the .ini file and sets the window's location, etc.
While size & location seem to be working properly, there's a strange issue with style. The two options are (1) Borderless and (2) With TitleBar, etc. There are multiple ways to force each of those and I've tried them all, and they work -- sort of.
What's happening is that regardless of which window style I set (#1 or #2), my window shows up the opposite of that every other launch. For example, if I set the .ini value to "borderless" and launch my app five times, it will launch differently each time -- borderless, bordered, borderless, bordered, borderless. Same behavior if the .ini value is the opposite.
I've not been able to target the source of this behavior but can only deduce it's something being done by the Unity Player (because my code doesn't change from run to run). Someone mentioned it may be storing window configuration in the Registry, but I'm overriding that after launch so would expect my values to take effect consistently.
Or perhaps it's a timing issue that could be solved by moving my .ini file processing until after some Unity Player initialization state?
Any ideas what's behind this behavior and/or how to get around it?
Thanks, ALF
Is there a way to make "-popupwindow" the default behavior for my app so that's what happens when you launch the .exe (rather than having to manually create a special shortcut with that command line option)?
Answer by alfarmer · Jan 06, 2014 at 08:53 PM
Well that's interesting. No code changes and now the behavior is I can't get rid of the window decorations. No matter what I try the window has a titlebar, border, sys_menu, etc.
Based on my testing it appears almost certain that Unity's Windows Standalone Player is SUPPRESSING attempts to change the window style at runtime. Thus the ONLY way to change window style is to relaunch your app with "-popupwindow" toggled on the command line.
Seems like a needless restriction...
Your answer
![](https://koobas.hobune.stream/wayback/20220613125710im_/https://answers.unity.com/themes/thub/images/avi.jpg)