plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent ed7b223c04
commit fd87a6ffd5
14441 changed files with 13711084 additions and 20 deletions

View File

@@ -0,0 +1,50 @@
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
using System;
public static class CollapseInspectorEditor
{
[MenuItem ("CONTEXT/Component/Collapse All")]
private static void CollapseAll (MenuCommand command)
{
SetAllInspectorsExpanded ((command.context as Component).gameObject, false);
}
[MenuItem ("CONTEXT/Component/Expand All")]
private static void ExpandAll (MenuCommand command)
{
SetAllInspectorsExpanded ((command.context as Component).gameObject, true);
}
public static void SetAllInspectorsExpanded (GameObject go, bool expanded)
{
Component[] components = go.GetComponents<Component> ();
foreach (Component component in components) {
if (component is Renderer) {
var mats = ((Renderer)component).sharedMaterials;
for (int i = 0; i < mats.Length; ++i) {
InternalEditorUtility.SetIsInspectorExpanded (mats [i], expanded);
}
}
InternalEditorUtility.SetIsInspectorExpanded (component, expanded);
}
ActiveEditorTracker.sharedTracker.ForceRebuild ();
}
public static void CollapseAllComponentsButOne (GameObject go, Type componentToCheck)
{
SetAllInspectorsExpanded (go, false);
Component componentToSearch = go.GetComponent (componentToCheck);
if (componentToSearch != null) {
InternalEditorUtility.SetIsInspectorExpanded (componentToSearch, true);
ActiveEditorTracker.sharedTracker.ForceRebuild ();
}
}
}
#endif