- Home /
Is there a way to disable Maximize on an EditorWindow?
I have a main EditorWindow that can open other EditorWindows as tool windows. The main EditorWindow closes the tool windows in OnDestroy. So far so good.
The problem is OnDestroy is called on tabbed windows when another window in the tab group is maximized. So if the main window is in a tab group with a tool window, and you maximize the tool window (by hitting space, or selecting maximize in the tab menu), then the main window tries to close the tool window that is maximizing, and it crashes Unity!
I'm checking for null window references, but I think everything happening at once causes the crash...
So, my question is this: Is there a way to disable Maximize on an EditorWindow? Or is anyone aware of some clever workaround for this problem? I've tried maxSize to no avail.
Thought I'd add that the crash bug when destroying tabbed windows has been fixed...
Answer by ramsey05 · Nov 30, 2021 at 10:17 PM
you can limit max and min-width or height via Init method this will automatically disable maximizing button
var window = GetWindow<awd>("Window");
window.maxSize = new Vector2(279, 279);
window.minSize = new Vector2(279, 219);
I know you won't see this but I posted it for the other people that came to see this post
Your answer
Follow this Question
Related Questions
How to receive a message that Unity is closing on a docked EditorWindow 0 Answers
How to avoid one button to be clicked when another button in footer overlaps it. 1 Answer
How do I stop new elements in a list/array from inheriting values from the last element? 1 Answer
Editor GUI Foldout header style customization 0 Answers
Scene Window goes grey in some scenes? 0 Answers