

This method works the same way as methods such as Awake or Update. UI Toolkit uses the CreateGUI method to add controls to Editor UI, and Unity calls the CreateGUI method automatically when the window needs to display. Editor window with custom title Add UI controls to the window Test your new window by opening it via the Unity Editor menu Tools > My Custom Editor. Wnd.titleContent = new GUIContent("My Custom Editor") This method is called when the user selects the menu item in the Editor To set the window title, change the EditorWindow.titleContent property.Īdd the following function inside the M圜ustomEditor class created in the previous step. Inside ShowMyEditor(), call the EditorWindow.GetWindow() method to create and display the window. In this example, the name of the static method is ShowMyEditor(). To open the new Editor window, you must create an entry in the Editor menu.Īdd the MenuItem attribute to a static method. This is an Editor-only window that includes the UnityEditor namespace, so the file must be placed under the Editor folder, or inside an Editor-only Assembly Definition. Public class M圜ustomEditor : EditorWindow
#Unity editor popup window code
Paste the following code into the script: using A custom Editor window is a class that derives from the EditorWindow class.Ĭreate a new script file M圜ustomEditor.cs under the Assets/Editor folder. More info See in Glossary in your project.
#Unity editor popup window windows
You can create Editor windows through C# scripts A piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. You might also have to add additional using directives at the top of the file, as shown below. For this guide please disable the UXML and USS checkboxes. From the Project window, right-click and select Create > UI Toolkit > Editor Window. You can generate the necessary code to create an Editor window script in the Unity Editor.

In this tutorial, you will create a sprite A 2D graphic objects. More info See in Glossary resizable and handling hot-reloading. Unity currently supports three UI systems. This guide covers creating an Editor window through code, reacting to user input, making the UI (User Interface) Allows a user to interact with your application. Custom Editor windows allow you to extend Unity by implementing your own editors and workflows.
