using UnityEngine; using System; namespace HighlightPlus { public class Misc { public static T FindObjectOfType(bool includeInactive = false) where T : UnityEngine.Object { #if UNITY_2023_1_OR_NEWER return UnityEngine.Object.FindAnyObjectByType(includeInactive ? FindObjectsInactive.Include : FindObjectsInactive.Exclude); #else return UnityEngine.Object.FindObjectOfType(includeInactive); #endif } public static UnityEngine.Object[] FindObjectsOfType(Type type, bool includeInactive = false) { #if UNITY_2023_1_OR_NEWER return UnityEngine.Object.FindObjectsByType(type, includeInactive ? FindObjectsInactive.Include : FindObjectsInactive.Exclude, FindObjectsSortMode.None); #else return UnityEngine.Object.FindObjectsOfType(type, includeInactive); #endif } public static T[] FindObjectsOfType(bool includeInactive = false) where T : UnityEngine.Object { #if UNITY_2023_1_OR_NEWER return UnityEngine.Object.FindObjectsByType(includeInactive ? FindObjectsInactive.Include : FindObjectsInactive.Exclude, FindObjectsSortMode.None); #else return UnityEngine.Object.FindObjectsOfType(includeInactive); #endif } } }