Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using UnityEngine;
  6.  
  7. public static class Extensions
  8. {
  9. // Potentially expensive.
  10. public static IEnumerable<T> GetComponentsWithInterface<T>(this GameObject go) where T : class {
  11. return go.GetComponents<Component>().OfType<T>();
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement