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. This would be used in place of ButtonManager in the following code, Is this possible? Could I use generics 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.
private GameObject[] FindInActiveObjectsByType()
{
List<GameObject> validTransforms = new List<GameObject>();
ButtonManager[] objs = Resources.FindObjectsOfTypeAll<ButtonManager>() as ButtonManager[];
for (int i = 0; i < objs.Length; i++)
{
if (objs[i].hideFlags == HideFlags.None)
{
objs[i].gameObject.GetComponent<ButtonManager>().ConfigureInteractives();
validTransforms.Add(objs[i].gameObject);
}
}
return validTransforms.ToArray();
}