I have tried to get a GameObject to destroy an item when touching, yet it just does not seem to work. I have on trigger disabled on all scripts.
code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerCollider : MonoBehaviour
{
public void OnCollisionEnter2D(Collision2D collision)
{
Debug.Log("collision");
if (collision.gameObject.CompareTag("enemy"))
{
Debug.Log("dead");
Destroy(collision.gameObject);
}
}