Hello,
I am making a 2D game, and the collision detection is not working at all. I am aware that one of the objects must be a Rigidbody (preferably the moving one) in order for a collision to be detected, which I have done already. I set the walls to be triggered by an Edge Collider 2D. This is my code for my trigger detection class:
public class BoundaryWall : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other)
{
Debug.Log(other.name + " entered the trigger");
}
void OnTriggerExit2D(Collider2D other)
{
Debug.Log(other.name + " exited the trigger");
}
}
The program does not even acknowledge that the character stepped over the triggers. I do not know how to detect collisions when the objects are supposed to move freely. Should I use RigidBody2D or RigidBody?