.comparetag unity code example
Example: unity comparetag
if (yourObject.gameObject.CompareTag ("Player"))
{
Debug.Log(yourObject.name + "has the tag 'Player' !");
}
if (yourObject.gameObject.CompareTag ("Player"))
{
Debug.Log(yourObject.name + "has the tag 'Player' !");
}