2025-05-21 16:25:35 +02:00

16 lines
365 B
C#

using UnityEngine;
public class TrashBin : MonoBehaviour
{
// Set this in the Inspector or use a constant
public string destroyTag = "Trash";
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag(destroyTag))
{
Destroy(other.gameObject);
Debug.Log($"Destroyed: {other.name}");
}
}
}