collider.tag code example
Example 1: how to check the tag of a collider in unity
void OnTriggerEnter(Collider collision)
{
if(collision.gameObject.tag == "[Tag]")
{
//Do Something...
}
}
Example 2: unity check tag
gameObject.tag
void OnTriggerEnter(Collider collision)
{
if(collision.gameObject.tag == "[Tag]")
{
//Do Something...
}
}
gameObject.tag