How to fill an array with different GameObjects?

Hello there!

Ive got a specific question maybe its a simple one, i dont know. Ive got different Objects with different tags, and i want to put them all into one array.

later - on the one hand - i want to check if there is a velocity on this objects. On the other hand i want to remove them from array, if they pass a collider. If i set up an array for all GameObjects by their own it works very well, but i want to put all the different GameObjects into one array.

Here are all the different Array i got.

    arrayGood = GameObject.FindGameObjectsWithTag("Sort_1");
arrayBad = GameObject.FindGameObjectsWithTag("Sort_2");
arrayClick = GameObject.FindGameObjectsWithTag("Sort_3");
arrayRollOn = GameObject.FindGameObjectsWithTag("Sort_4");
arrayPillow = GameObject.FindGameObjectsWithTag("Sort_5"); 

I want to put them all into one “large” array like this:

arrayAllObjects = GameObject.FindGameObjectsWithTag(“Sort_1”)&& GameObject.FindGameObjectsWithTag(“Sort_2”) && GameObject.FindGameObjectsWithTag(“Sort_3”) && GameObject.FindGameObjectsWithTag(“Sort_4”) && GameObject.FindGameObjectsWithTag(“Sort_5”)

But if i do it like that only the last object/array (“Sort_5”) will be loaded into this array.

Can someone please tell me how i can set up this kind of array? Thank you so much!

You did not specify what language, in c# you can initial or set an array with the items you with.

using System.Collections.Generic;

GameObject[] arrayAllObjects = { GameObject.FindGameObjectsWithTag("Sort1"), GameObject.FindGameObjectsWithTag("Sort2"),  GameObject.FindGameObjectsWithTag("Sort3"),  GameObject.FindGameObjectsWithTag("Sort4"),  GameObject.FindGameObjectsWithTag("Sort_5") };

// Or you can use a list c#

List<GameObject> allObjects = new List<GameObject> { GameObject.FindGameObjectsWithTag("Sort1"), GameObject.FindGameObjectsWithTag("Sort2"),  GameObject.FindGameObjectsWithTag("Sort3"),  GameObject.FindGameObjectsWithTag("Sort4"),  GameObject.FindGameObjectsWithTag("Sort_5") };

// UnityScript, in this case we are using the constructor that takes an array to instantiate the list, i don’t think i need to show the unityscript version of a generalized gameobject array.

   import System.Collections.Generic;

   var allObjects: new List.<GameObject>([GameObject.FindGameObjectsWithTag("Sort1"), GameObject.FindGameObjectsWithTag("Sort2"),  GameObject.FindGameObjectsWithTag("Sort3"),  GameObject.FindGameObjectsWithTag("Sort4"),  GameObject.FindGameObjectsWithTag("Sort_5")]);