Recently I’ve been having a lot of trouble with the OnTriggerEnter2D and OnCollisionEnter2D functions. when i first implemented it, there were no problems. But now the function never gets called even when I do log it into the debugger. My Player GameObject just goes through the other GameObject I want it to interact with. I’ve looked everywhere online and tried the many solutions people have suggested for this issue but they were unsuccessful.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Detonate : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Player")
{
Debug.Log(other.name);
Destroy(other.gameObject);
Destroy(gameObject);
}
}
}`