Tired of writing out GetComponents<Blah>()
and then GetComponentsInChildren<Blah>()
? Well, here are two functions which do that for you.
To use it, just shove it in some file. Then, do transform.GetAllComponents<Blah>()
and voila! You have all components of this type in a nice, enumerable format.
public static class TransformExtensions
{
public static IEnumerable<T> GetAllComponents<T>(this Transform transform)
{