CompareTag

CompareTag
CompareTag
■CompareTag(コンペアタグ)
タグ同士を比較するための関数
if (collision.gameObject.CompareTag("Player"))
↑直接文字列を入力。
if (collision.gameObject.CompareTag(_Player.tag))
↑比較したいものを変数で宣言し、Tagを取ってくる。
.CompareTag("比較したいタグ名")で比較する。
比較の結果同じだった場合はTrueになる。
普通の比較より処理が速いので推奨される。
普通の比較→(gameObject.tag == "Player")