# CreateGUI()

> CreateGUI is called when the EditorWindow's rootVisualElement is ready to be populated.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)

```csharp
public void CreateGUI()
```

### Remarks

Use `CreateGUI` to add UI Toolkit UI elements to your window. When creating a custom Editor window, follow these guidelines: - Put code dependent on UXML/USS loading in the [EditorWindow.CreateGUI()](/engine/6000.3/script-reference/unityeditor/editorwindow/creategui.md) method to ensure that all necessary assets are available. - Keep the event registration code inside [EditorWindow.CreateGUI()](/engine/6000.3/script-reference/unityeditor/editorwindow/creategui.md) or after [EditorWindow.CreateGUI()](/engine/6000.3/script-reference/unityeditor/editorwindow/creategui.md) is called. It's important to note that `CreateGUI` might not be called before the first call to [EditorWindow.Update()](/engine/6000.3/script-reference/unityeditor/editorwindow/update.md). For more information, refer to [EditorWindow](/engine/6000.3/script-reference/unityeditor/editorwindow.md). For an example on how to create an Editor window to react to user input, refer to [Create a custom Editor window with C# script](/engine/6000.3/manual/uitoolkits/uielements/uie-support-for-editor-ui/uie-how-to-create-editor-window.md).

### Examples

```csharp

{code Modules/UIElements/Tests/UIElementsExamples/Assets/EditorWindowCodeExamples/MouseOverWindowExample.cs}
```
