Home > Blockchain >  Unity OnTriggerEnter2D() not responding
Unity OnTriggerEnter2D() not responding

Time:06-09

This Is a bug that I've been trying to solve for about 2 hours, and yet to no avail. I've read pretty much EVERY single post about this but anyways here's my code:

using UnityEngine;

public class Enemy_Sideways : MonoBehaviour
{
    [SerializeField]private float damage;

    private void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log("AA");
        if (other.tag == "Player")
        {
            Debug.Log("Right now I am the shell of my former body");
        }
    }
}

Here are all the ways I have already tried using:

-Spelling
-RigidBody2D
-RigidBody2D(not-kinematic)

CodePudding user response:

Any one should have rigidBody2D and 2d colliders works with 2D only, or try reloading project

CodePudding user response:

I now noticed what I did wrong( a very stupid miscalculation ) but in order to help people I will post this. I forgot to add the Box Collider 2D method. I fully blame myself.

  • Related