How can I make an if statement check for two different tags. I want to check for tag Player and tag Enemy.
My code is but I would like to check for tag Enemy too:
if(hit.collider.tag!=“Player”){
How can I make an if statement check for two different tags. I want to check for tag Player and tag Enemy.
My code is but I would like to check for tag Enemy too:
if(hit.collider.tag!=“Player”){
If you mean “how can I check to see if this is a player or an enemy” then this is the code:
if ((hit.CompareTag("Player") == true) || (hit.CompareTag("Enemy") == true))
{
...blah blah blah...
}
But if you mean how I can check to see if an object has two tags on it, you cannot, as objects can only have a single tag on them.
thanks