Added a bunch of utilities and modfief the character data structue

This commit is contained in:
Sebastian Bularca
2026-03-29 18:31:03 +02:00
parent 4a9c00212a
commit ee97b2fec3
110 changed files with 6752 additions and 169 deletions

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using System;
using UnityEditor.SceneManagement;
#endif
namespace Jovian.Utilities {
public static class HierarchyUtility {
#if UNITY_EDITOR
public static List<TComponent> FindComponentsInHierarchy<TComponent>(bool includeInactive = false) where TComponent : Component {
PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
if(prefabStage == null) {
return SceneUtility.FindComponentsInActiveScene<TComponent>(includeInactive);
}
else {
return new List<TComponent>(prefabStage.prefabContentsRoot.GetComponentsInChildren<TComponent>(includeInactive));
}
}
public static List<Component> FindComponentsInHierarchy(Type componentType, bool includeInactive = false) {
PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
if(prefabStage == null) {
return SceneUtility.FindComponentsInActiveScene(componentType, includeInactive);
}
else {
return new List<Component>(prefabStage.prefabContentsRoot.GetComponentsInChildren(componentType, includeInactive));
}
}
#endif
}
}