EditorWindow Class, inherits from ScriptableObjectDerive from this class to create an editor window.
Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script. Create your own custom editor window that can float free or be docked as a tab, just like the native windows in the Unity interface. Editor windows are typically opened using a menu item. // JavaScript example: class MyWindow extends EditorWindow { var myString = "Hello World"; var groupEnabled = false; var myBool = true; var myFloat = 1.23; // Add menu named "My Window" to the Window menu @MenuItem ("Window/My Window") static function Init () { // Get existing open window or if none, make a new one: var window : MyWindow = EditorWindow.GetWindow (MyWindow); window.Show (); } function OnGUI () { GUILayout.Label ("Base Settings", EditorStyles.boldLabel); myString = EditorGUILayout.TextField ("Text Field", myString); groupEnabled = EditorGUILayout.BeginToggleGroup ("Optional Settings", groupEnabled); myBool = EditorGUILayout.Toggle ("Toggle", myBool); myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3); EditorGUILayout.EndToggleGroup (); } } // C# example:
using UnityEngine; using UnityEditor; public class MyWindow : EditorWindow { string myString = "Hello World"; bool groupEnabled; bool myBool = true; float myFloat = 1.23f; // Add menu named "My Window" to the Window menu [MenuItem ("Window/My Window")] static void Init () { // Get existing open window or if none, make a new one: MyWindow window = (MyWindow)EditorWindow.GetWindow (typeof (MyWindow)); window.Show (); } void OnGUI () { GUILayout.Label ("Base Settings", EditorStyles.boldLabel); myString = EditorGUILayout.TextField ("Text Field", myString); groupEnabled = EditorGUILayout.BeginToggleGroup ("Optional Settings", groupEnabled); myBool = EditorGUILayout.Toggle ("Toggle", myBool); myFloat = EditorGUILayout.Slider ("Slider", myFloat, -3, 3); EditorGUILayout.EndToggleGroup (); } } Variables
Functions
Messages Sent
Class Variables
Class Functions
Inherited members
Inherited Variables
Inherited Functions
Inherited Messages Sent
Inherited Class Functions
|
