Constraining EditorWindow size

How do you set the minimum size a custom EditorWindow can be? I’ve tried so many different things, and just can’t figure it out…

I’ve tried stuff like this:

void Update or OnGUI () {
   if (position.width < 50)
      position = new Rect (position.x, position.y, 50, position.height);
}

This didn’t work well at all. It just made my window act all glitchy.

For a great example of what I’m after, just open the Asset Store window. And try to shrink it. It elegantly doesn’t allow you to do so. How?

Resurrecting old thread, because I was looking for same functionality, but have not found. Yet later I could find it myself. Maybe someone will find it useful :slight_smile:

EditorWindow window = new EditorWindow();
window.maxSize = new Vector2(215f, 110f);
window.minSize = window.maxSize;
16 Likes

Thanks…