Create Your Own Editor Window | Editor Scripting | C# | Unity Game Engine


TestWindow.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

public class TestWindow : EditorWindow
{
    string myString = "Hi";
    float myFloat = 0f;
    bool myBool = false;
    bool isGroupEnabled = false;

    [MenuItem("Custom Window/Test Window")]
    public static void OpenWindow()
    {
        EditorWindow.GetWindow(typeof(TestWindow));
    }

    void OnGUI()
    {
        GUILayout.Label("Header", EditorStyles.boldLabel);
        myString = EditorGUILayout.TextField("Text", myString);

        isGroupEnabled = EditorGUILayout.BeginToggleGroup("Toggle Settings", isGroupEnabled);
        myFloat = EditorGUILayout.Slider("Slider", myFloat, -10, 10);
        myBool = EditorGUILayout.Toggle("Toggle", myBool);
        EditorGUILayout.EndToggleGroup();

        if(GUILayout.Button("Reset"))
        {
            myString = "Hi";
            myFloat = 0f;
            myBool = false;
            isGroupEnabled = false;
        }
    }
}