How do i stop the OnGUI Window from been re-sizable?
This is the resizing I am able to do but how can i have a set Width & Height so this cant happen.
Code
public class About_OpenScene : EditorWindow
{
void OnGUI()
{
PlayerSettings.resizableWindow = false;
GUILayout.Width(100);
GUILayout.Height(100);
GUILayout.MaxWidth(120);
GUILayout.MaxHeight(120);
GUILayout.MinWidth(120);
GUILayout.MinHeight(120);
EditorGUILayout.LabelField("Information:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Version: 1.0");
EditorGUILayout.LabelField("Developed by: Scott Durkin");
EditorGUILayout.LabelField("Last Updated: 29/11/2016");
EditorGUILayout.LabelField("Description:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("OpenScene is designed to manage all scenes in your (Scene) Folder.");
EditorGUILayout.LabelField("This plugin makes it easier to switch between scenes and with each");
EditorGUILayout.LabelField("switch a check for any changes is carried out and asks you to save");
EditorGUILayout.LabelField("them before switching.");
//if (GUILayout.Button("Close"))
// Close();
}
[MenuItem("Open Scene/Information")]
static void OpenSceneWindow()
{
About_OpenScene window = new About_OpenScene();
window.ShowUtility();
}
}
It will eliminate the ability to increase the size. Not shrink the size, though. For that, make the min size equal to the max size. Also, this only is in effect while the window is not docked. If you dock it, there is no way to constrain the window size. There may be a way to prevent an EditorWindow from being docked altogether, but I believe it would involve using Reflection to get internal types in the UnityEditor dll. This is just a starting idea for how that might go, but this code is not working - just a primer:
var editorAsm = typeof(Editor).Assembly;
Type inspWndType = editorAsm.GetType("UnityEditor.DockArea");
UnityEngine.Object dockArea = ScriptableObject.CreateInstance(inspWndType);