title: Using generics as variable types in Unity
body: <p><b>I wish to change the following code so I could pass a parameter of type T or Component in this function such that it can be used in the type arguments</b>. This would be used in place of <code>ButtonManager</code> in the following code, Is this possible? Could I use <code>generics</code> to accomplish this? I wish to do this so I can reuse this method for a variety of Component types, vice having to make a method per component type. </p>
  
  <pre><code>private GameObject[] FindInActiveObjectsByType()
      {
          List&lt;GameObject&gt; validTransforms = new List&lt;GameObject&gt;();
          ButtonManager[] objs = Resources.FindObjectsOfTypeAll&lt;ButtonManager&gt;() as ButtonManager[];
          for (int i = 0; i &lt; objs.Length; i++)
          {
              if (objs[i].hideFlags == HideFlags.None)
              {
                  objs[i].gameObject.GetComponent&lt;ButtonManager&gt;().ConfigureInteractives();
                  validTransforms.Add(objs[i].gameObject);
              }
          }
          return validTransforms.ToArray();
      }
  </code></pre>