So I noticed that one can group tags in the tag/layer manager- ie. “Item/pickup” I was wondering if there was a way to check if an object is just in a specific group. Like in the Item/pickup example, I just want to know if the object is in the “Item” group. Thanks Much! -LMan
Hey,
Yes, its a simple if check:
if (gameObject.tag == "pickup"){
// Do stuff because I am a pickup
}
Or if you have multiples tags you could check it using a switch:
switch (gameObject.tag){
case "pickup":
// Do stuff here
break;
case "item":
// etc
break;
case "player"
// etc
break;
default:
// this case must be included
break;
}