新增UI编辑器功能

This commit is contained in:
MuHua-123
2025-10-04 09:28:18 +08:00
parent f4a07224aa
commit 9be153994f
8 changed files with 124 additions and 34 deletions
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ed61f5627e04e114eb2c086ae01dc7b4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-18
View File
@@ -1,18 +0,0 @@
{
"name": "ModuleEditor",
"rootNamespace": "",
"references": [
"GUID:432b70115e987f44abb984cfe7de384f"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 779534da92936794a829f8bf18309372
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-27
View File
@@ -1,27 +0,0 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
public class TestEditorWindow : EditorWindow {
[SerializeField]
private VisualTreeAsset m_VisualTreeAsset = default;
[MenuItem("Window/MuHua/TestEditorWindow")]
public static void ShowExample() {
TestEditorWindow wnd = GetWindow<TestEditorWindow>();
wnd.titleContent = new GUIContent("TestEditorWindow");
}
public void CreateGUI() {
// Each editor window contains a root VisualElement object
VisualElement root = rootVisualElement;
// VisualElements objects can contain other VisualElement following a tree hierarchy.
VisualElement label = new Label("Hello World! From C#");
root.Add(label);
// Instantiate UXML
VisualElement labelFromUXML = m_VisualTreeAsset.Instantiate();
root.Add(labelFromUXML);
}
}
@@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: ccbcb6aee5874ac4ba30fcb269d7c7ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- m_VisualTreeAsset: {fileID: 9197481963319205126, guid: d23b67a16b48c2243aabe57056dbfbed, type: 3}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: