using UnityEngine; using UnityEditor; public class EditorTestScript : EditorWindow { private string _jsonData = "{\"base64Data\": \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAAXNSR0IArs4c6QAAABRJREFUGFdj/M/A8J+BgYGBEcYAACwBA/9pGIu9AAAAAElFTkSuQmCC\", \"tiling_x\": 20, \"tiling_y\": 20}"; private FloorTextureManager _wallTextureManager; [MenuItem("Window/Test Wall Texture")] public static void ShowWindow() { GetWindow("Test Wall Texture"); } [MenuItem("Window/Test Paving Texture")] public static void Paving() { // MeshGenerator. } private void OnEnable() { // 尝试在场景中找到 WallTextureManager _wallTextureManager = FindObjectOfType(); if (_wallTextureManager == null) { Debug.LogError("WallTextureManager not found in the scene!"); } } private void OnGUI() { if (_wallTextureManager == null) { EditorGUILayout.LabelField("WallTextureManager not found in the scene!"); return; } _jsonData = EditorGUILayout.TextField("JSON Data", _jsonData); if (GUILayout.Button("Update Wall Texture")) { _wallTextureManager.UpdateFloorTexture(_jsonData); } } }