Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created September 3, 2020 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todorok1/661a80d840c94b981ee0969aea21418e to your computer and use it in GitHub Desktop.
Save todorok1/661a80d840c94b981ee0969aea21418e to your computer and use it in GitHub Desktop.
衝突相手のタグを確認するサンプル
/// <Summary>
/// コライダーに衝突したゲームオブジェクトを破棄します。
/// </Summary>
void OnCollisionEnter(Collision other)
{
if (other.gameObject.tag == "Bullet")
{
// 衝突した相手を闇の彼方に消し去ります。
Destroy(other.gameObject);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment