Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created September 3, 2020 08:29
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/775775b88b71c419c06f4d37a0abc5ce to your computer and use it in GitHub Desktop.
Save todorok1/775775b88b71c419c06f4d37a0abc5ce to your computer and use it in GitHub Desktop.
コライダーに衝突したゲームオブジェクトを破棄するスクリプトです。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <Summary>
/// コライダーに衝突したゲームオブジェクトを破棄するスクリプトです。
/// </Summary>
public class ObjectEraser : MonoBehaviour
{
void Start()
{
}
void Update()
{
}
/// <Summary>
/// コライダーに衝突したゲームオブジェクトを破棄します。
/// </Summary>
void OnCollisionEnter(Collision other)
{
// 衝突した相手を闇の彼方に消し去ります。
Destroy(other.gameObject);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment