fix find tag mutltiple tags???

hey guys if have a problem i want to use multiple tags at once
this is to find my enemy with a tag but i want to know how i could do this


First tag = Player
Second tag =Spartan_enemy
i traid it but it does not work i alreddy ecpected it but dont know how to fix it the problem is in the Tag “” but i dont know if i need a . or , So how do i do this??


You can’t do a FindWithTag with multiple tag in the function parameters. Sorry.

You must iterate on a tag list and pass the element of this tag list to the function “FindWithTag” one by one.
I don’t know another solution…

As the guy did in this solution :

are you trying to get 2 different tagged objects at once. or an object with 2 tags?

As liszto said, the latter is not possible without a workaround.


If your problem is the former, then perhaps I can help.


    GameObject[] a1 = GameObject.FindGameObjectsWithTag("Spartan_enemy");
	GameObject[] a2 = GameObject.FindGameObjectsWithTag("Player");
	GameObject[] a3 = new GameObject[a1.Length+a2.Length];
	for(int i = 0; i < a1.Length; i++)
		a3 _= a1*;	*_

* }*

* for (int j = 0; j < a2.Length; j++)*
* {*
_ a3[j+a1.Length] = a2*;

This is not the optimal method, especially if you only have 1 player. But it should work. “a3” will be an array containing all Spartan_enemy tagged objects and all Player tagged objects.