- Home /
How would I add multiple gameobjects with different tags into one
1SpawnPoints = GameObject.FindGameObjectsWithTag("topspawner");
1SpawnPoints += GameObject.FindGameObjectsWithTag("bottomspawner");
1SpawnPoints += GameObject.FindGameObjectsWithTag("leftspawner");
1SpawnPoints += GameObject.FindGameObjectsWithTag("rightspawner");
so if I wanted to have certain spawnpoints for 1SpawnPoints then i made a seperate variables 2SpawnPoints where I wanted just top and bottom, how would I do that?
Um, does that code even compile? What language is this and where is 1SpawnPoints defined?
No it doesn't compile but I'm just trying to let you visualize what I want to do
This is AWFULLY close to script-begging, which is not allowed in questions. However because its so $$anonymous$$imal I'll show you some code. But PLEASE go learn how C# works.
private GameObject[] 2SpawnPoints = new GameObject[2];
2SpawnPoints[0] = GameObject.FindGameObjectWithTag('topspawner");
2SpawnPoints[1] = GameObject.FindGameObjectWithTag('bottomspawner");
This assumes there is only one object with the tag "topspawner" and one object with the tag "bottomspawner" in your scene. If there are more then it will only get the first of each.
Answer by meat5000 · May 31, 2014 at 07:01 PM
Firstly, please don't start a new question on the same topic if you don't get what you want in this one.
Secondly, try lists.
Its like an array that you can add to in a similar fashion to what you suggest in the Question.
I provided a link in the above comment.
Your answer
![](https://koobas.hobune.stream/wayback/20220613150357im_/https://answers.unity.com/themes/thub/images/avi.jpg)