// note, this is not very efficient, as evidenced by the three levels of looping required. // If you call this every frame, you will not be a happy person. public static class GameObjectHelpers { public static GameObject[] FindGameObjectsWithTag(string tag, bool activesOnly = true) { if(activesOnly) return GameObject.FindGameObjectsWithTag(tag); else { List RetVal = new List(); for(int i = SceneManager.sceneCount - 1; i >= 0; --i) { var Scene = SceneManager.GetSceneAt(i); if(Scene.isLoaded) foreach(var RootGO in Scene.GetRootGameObjects()) foreach(var T in RootGO.GetComponentsInChildren(true)) if(T.CompareTag(tag)) RetVal.Add(T.gameObject); } return RetVal.ToArray(); } } }