1 public static T[] FindObjectOfInterfaces<T>() where T : class
2 {
3 List<T> list = new List<T>();
4 foreach ( var n in GameObject.FindObjectsOfType<Component>() )
5 {
6 var component = n as T;
7 if ( component != null )
8 {
9 list.Add (component);
10 }
11 }
12 T[] ret = new T[list.Count];
13 int count = 0;
14 foreach (T component in list) {
15 ret[count] = component;
16 count++;
17 }
18 return ret;
19 }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。