ソースコード
using System.Linq; using UnityEngine; public static class GameObjectExtensions { public static T[] GetComponentsInChildrenWithoutSelf<T>(this GameObject self) where T : Component { return self.GetComponentsInChildren<T>().Where(c => self != c.gameObject).ToArray(); } }
使い方
gameObject.GetComponentsInChildrenWithoutSelf<UIWidget>();