Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using UnityEngine;
- public static class Extensions
- {
- // Potentially expensive.
- public static IEnumerable<T> GetComponentsWithInterface<T>(this GameObject go) where T : class {
- return go.GetComponents<Component>().OfType<T>();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement