From 65731693e82ab9fa554fb2c03c233859c934f8d6 Mon Sep 17 00:00:00 2001 From: ManlyMarco <39247311+ManlyMarco@users.noreply.github.com> Date: Wed, 29 May 2024 21:34:11 +0200 Subject: [PATCH] Remove SceneDumper and "Dump obj" button Was replaced by ObjectDumper. Dump objects by right clicking them now. --- RuntimeUnityEditor/Utils/SceneDumper.cs | 62 ------------------- .../Windows/ObjectTree/ObjectTreeViewer.cs | 4 -- 2 files changed, 66 deletions(-) delete mode 100644 RuntimeUnityEditor/Utils/SceneDumper.cs diff --git a/RuntimeUnityEditor/Utils/SceneDumper.cs b/RuntimeUnityEditor/Utils/SceneDumper.cs deleted file mode 100644 index 76bcc34..0000000 --- a/RuntimeUnityEditor/Utils/SceneDumper.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Reflection; -using System.Text; -using RuntimeUnityEditor.Core.Utils.Abstractions; -using UnityEngine; - -namespace RuntimeUnityEditor.Core.Utils -{ - internal static class SceneDumper - { - public static void DumpObjects(params GameObject[] objects) - { - var fname = Path.GetTempFileName() + ".txt"; - RuntimeUnityEditorCore.Logger.Log(LogLevel.Info, $"Dumping {objects.Length} GameObjects to {fname}"); - using (var f = File.OpenWrite(fname)) - using (var sw = new StreamWriter(f, Encoding.UTF8)) - { - foreach (var obj in objects) - PrintRecursive(sw, obj); - } - var pi = new ProcessStartInfo(fname) { UseShellExecute = true }; - RuntimeUnityEditorCore.Logger.Log(LogLevel.Info, $"Opening {fname}"); - Process.Start(pi); - } - - private static void PrintRecursive(TextWriter sw, GameObject obj, int d = 0) - { - if (obj == null) return; - - var pad1 = new string(' ', 3 * d); - var pad2 = new string(' ', 3 * (d + 1)); - var pad3 = new string(' ', 3 * (d + 2)); - sw.WriteLine(pad1 + obj.name + "--" + obj.GetType().GetSourceCodeRepresentation()); - - foreach (var c in obj.GetComponents()) - { - if(c == null) continue; // Sometimes they can be null for some reason - - sw.WriteLine(pad2 + "::" + c.GetType().Name); - - var ct = c.GetType(); - var props = ct.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance); - foreach (var p in props) - { - try - { - var v = p.GetValue(c, null); - sw.WriteLine(pad3 + "@" + p.Name + "<" + p.PropertyType.Name + "> = " + v); - } - catch (Exception e) - { - RuntimeUnityEditorCore.Logger.Log(LogLevel.Debug, e); - } - } - } - foreach (Transform t in obj.transform) - PrintRecursive(sw, t.gameObject, d + 1); - } - } -} diff --git a/RuntimeUnityEditor/Windows/ObjectTree/ObjectTreeViewer.cs b/RuntimeUnityEditor/Windows/ObjectTree/ObjectTreeViewer.cs index 301d810..cb8a964 100644 --- a/RuntimeUnityEditor/Windows/ObjectTree/ObjectTreeViewer.cs +++ b/RuntimeUnityEditor/Windows/ObjectTree/ObjectTreeViewer.cs @@ -557,10 +557,6 @@ private void DisplayTreeSearchBox() GUILayout.Space(3); - if (SelectedTransform == null) GUI.enabled = false; - if (GUILayout.Button("Dump obj", GUILayout.ExpandWidth(false))) - SceneDumper.DumpObjects(SelectedTransform?.gameObject); - GUI.enabled = true; } GUILayout.EndHorizontal();