Howdy,
I tried using the script posted here and it works great! except for one issue, when the application resizes, all my buttons’ hitboxes are offset. have any of y’all run into this issue and if so, have you found a solution?
Hey there, this topic is a bit old, but I’ll try to help you as much as I can. I never encountered this problem with my UI, so it must mean either your canvas is not set to screen space camera, or your buttons have their anchors set incorrectly. I don’t really know what causes this problem, so it must be one of these.
I’m having the same issue on our project. At the time, windowless was an optional feature so we just dropped it, but it would be great to be able to resolve it.
Regarding your suggested fixes, our project is completely in screen space and the buttons’ anchors are all set correctly (everything lines up exactly when the titlebar hider is disabled).
I noticed you resolved this a while ago - does your solution still work in 2019.3? Perhaps this was a bug introduced recently in the engine.
Here’s the inspector for our main canvas in the project which exhibited the issue, in case you see any clues here that are different from yours in important ways:

My canvas and anchors are set correctly, I’ve even gone as far as double checking them to be safe.
I’ts not that my buttons aren’t appearing after hiding the bar, but that their event detection (mouseover, click, etc) is no longer on the image. The button works fine at any resolution I’ve tried, so long as I don’t hide the title bar.

Edit:
I did some more digging and found where someone has published a script that does exactly what I was looking to do. I’m not sure if this will help anyone else out, but I’ll drop a link to it.
https://novack.itch.io/borderless
I’ve already tried this asset, and even left a debug message for the developer ; I wouldn’t personnaly recommend it since it has pretty impredictable results, but if it does what you wanted to achieve, go for it.
I’ve attached a few pictures to show you my full setup, however mine is a bit tricky, since I have multiple screens dealing with resizing the window at once : WindowScript and ToolbarHider. SInce ToolbarHider is already shown in the thread, here is WindowScript. It contrains only functions you can call by UI buttons to resize, maximize, close and drag the window. Make sure the pixel offset in ToolbalHider and WindowScript is always the same :
As for my setup :

I hope this helps, if you have more questions don’t hesitate.
anyone give some guidance on how to do this on linux?
HI, who know how do this from MacOS?
I think its in the unity build menu, build settings, player settings
You can also do it via the operating system in linux.
Hi Griz, thanks for your solution. It is working fine for me, i use Unity 2020.1.11f1
With your script the Titlebar is hidden:
,
These are my Settings, game is build in resolution for Samsung S10e, and also only in portrait mode in windows.
My initiall problem was, that a litte bit of my gamewindow was out of my display because the TitleBar from windows was added to the resolution.
also for the other people, maybe have a look at: Borderless Unity Window by Novack
Is it possible to make window tile the same as in here:
Examples
Make it like a transparent but keeping functionality?
No because thats not the Windows title bar. Its a custom one that just calles the same functions as the default one
For macOS, create a dynamic library project in XCode. Put the following Objective-C code into the project:
TitlebarLib.h
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#if __cplusplus
extern "C" {
#endif
int ShowTitleBar();
int HideTitleBar();
#if __cplusplus
}
#endif
TitlebarLib.m
#import "TitlebarLib.h"
int ShowTitleBar() {
NSWindow* win = [NSApplication.sharedApplication mainWindow];
win.titleVisibility = NSWindowTitleVisible;
win.titlebarAppearsTransparent = false;
win.movableByWindowBackground = false;
win.styleMask &= ~NSWindowStyleMaskFullSizeContentView;
return 0;
}
int HideTitleBar() {
NSWindow* win = [NSApplication.sharedApplication mainWindow];
win.titleVisibility = NSWindowTitleHidden;
win.titlebarAppearsTransparent = true;
win.movableByWindowBackground = true;
win.styleMask |= NSWindowStyleMaskFullSizeContentView;
return 0;
}
Build the XCode project. Put the output file libTitlebarLib.dylib into the Plugins dir of the Unity project. Use the following code to import the two native functions:
using System.Runtime.InteropServices;
using UnityEngine;
public class GameManager : MonoBehaviour {
[DllImport("libTitlebarLib")]
public extern static int ShowTitleBar();
[DllImport("libTitlebarLib")]
public extern static int HideTitleBar();
public void OnShowTitleBar() {
int ret = ShowTitleBar();
Debug.Log($"ShowTitleBar = {ret}");
}
public void OnHideTitleBar() {
int ret = HideTitleBar();
Debug.Log($"HideTitleBar = {ret}");
}
}

Why is my window so tiny??

Please create your own posts. Do not necro/hijack threads.



