using System.Collections; using System.Collections.Generic; using System.IO; using DG.Tweening; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UIElements; using System.Reflection; using System; using System.Linq; public class AutoGenerate : EditorWindow { private VisualElement rootElement; private Button generateBtn; private Label hintText; private TextField nameInput; private string scenePath; private string scriptPath; private string prefabPath; [MenuItem("Window/Generate Editor Window")] public static void ShowExample() { AutoGenerate wnd = GetWindow(); wnd.titleContent = new GUIContent("Auto Generate UI Window"); } public void CreateGUI() { // scenePath = Application.dataPath + "/TestUIPanelScenes"; // scriptPath = Application.dataPath + "/Scripts/Project/UI/UI_Panel"; // prefabPath = Application.dataPath + "/Resources/UI/UI_Panel"; scenePath = ""; scriptPath = "Assets/Test2"; prefabPath = "Assets/Resources/UI/UI_Panel"; // scenePath = "Assets/TestUIPanelScenes"; // scriptPath = "Assets/Scripts/Project/UI/UI_Panel"; // prefabPath = "Assets/Resources/UI/UI_Panel"; // string xmlPath = Path.Combine(Application.dataPath, "ThridPart", "UIToolKitFile", "UDoc", "UXml", "AutoGenerateUI.uxml"); // string xmlPath = "Assets/UIToolKitFile/UDoc/UXml/AutoGenerateUI.uxml"; var visualTree = AssetDatabase.LoadAssetAtPath("Assets/ThirdPart/UIToolKitFile/UDoc/UXml/AutoGenerateUI.uxml"); rootElement = visualTree.CloneTree(); rootVisualElement.Add(rootElement); generateBtn = rootElement.Q