using FishNet.Object; using System.Collections.Generic; using UnityEngine; namespace FishNet.Utility.Performance { public static class GetNonAlloc { /// /// /// private static List _transformList = new List(); /// /// /// private static List _networkBehavioursList = new List(); /// /// Gets all NetworkBehaviours on a transform. /// public static List GetNetworkBehaviours(this Transform t) { t.GetComponents(_networkBehavioursList); return _networkBehavioursList; } /// /// Gets all transforms on transform and it's children. /// public static List GetTransformsInChildrenNonAlloc(this Transform t, bool includeInactive = false) { t.GetComponentsInChildren(includeInactive, _transformList); return _transformList; } } }