This is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor.UIElements;
public class TaskListEditor : EditorWindow
{
VisualElement container;
public const string path = "Assets/TaskList/Editor/EditorWindow/";
[MenuItem("Nathan/Task List")]
public void ShowWindow()
{
TaskListEditor window = GetWindow<TaskListEditor>();
window.titleContent = new GUIContent("Task List");
}
public void CreateGUI()
{
container = rootVisualElement;
VisualTreeAsset original = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(path + "TaskListEditor.uxml");
container.Add(original.Instantiate());
StyleSheet styleSheet = AssetDatabase.LoadAssetAtPath<StyleSheet>(path + "TaskListEditor.uss");
container.styleSheets.Add(styleSheet);
}
}