using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Convention { public interface ILoadedInHierarchy { } public interface IOnlyLoadedInHierarchy { } public class HierarchyLoadedIn : MonoAnyBehaviour { private void Update() { if (!RegisterBaseWrapperExtension.Registers.ContainsKey(typeof(WindowsUI.Variant.HierarchyWindow))) return; var onlys = GetComponents(); try { if (onlys != null && onlys.Length != 0) { WindowsUI.Variant.HierarchyWindow.instance.CreateRootItemEntryWithBinders(onlys[0])[0] .ref_value .GetComponent() .title = $"{name}"; } else { var components = GetComponents(); if (components.Length > 1) { var goItem = WindowsUI.Variant.HierarchyWindow.instance.CreateRootItemEntryWithGameObject(gameObject); goItem.ref_value.GetComponent().title = $"{name}"; foreach (var item in components) { goItem.ref_value.GetComponent().CreateSubPropertyItemWithBinders(item)[0] .ref_value .GetComponent() .title = $"{name}-{item.GetType()}"; } } else if(components.Length==1) { WindowsUI.Variant.HierarchyWindow.instance.CreateRootItemEntryWithBinders(components[0])[0] .ref_value .GetComponent() .title = $"{name}"; } else { var goItem = WindowsUI.Variant.HierarchyWindow.instance.CreateRootItemEntryWithGameObject(gameObject); goItem.ref_value.GetComponent().title = $"{name}"; foreach (var item in GetComponents()) { goItem.ref_value.GetComponent().CreateSubPropertyItemWithBinders(item)[0] .ref_value .GetComponent() .title = $"{name}-{item.GetType()}"; } } } } catch (Exception) { } finally { GameObject.DestroyImmediate(this); } } } }