mirror of
https://github.com/Steffo99/mission-failed.git
synced 2024-12-04 22:04:17 +00:00
17 lines
392 B
C#
17 lines
392 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class DestroyObjectOnHit : MonoBehaviour
|
|
{
|
|
public bool destroyWithAnyTag = false;
|
|
public string tagName;
|
|
|
|
void OnCollisionEnter2D(Collision2D collision)
|
|
{
|
|
GameObject collidedObj = collision.gameObject;
|
|
if (collidedObj.CompareTag(tagName))
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|