I have 2 objects, one that moves down at a constant velocity and a player controlled object. Both objects have BoxCollider2D and Rigidbody2D yet the OnCollisonEnter2D method attached to the controllable object isnt being called. Both the objects are colliding visibly colliding with each other and will rotate so long as freeze rotation is not on. Bellow is the code for the OnCollisonEnter2D method. What am I doing wrong?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Collisons : MonoBehaviour
{
public int Score;
public void OnCollisonEnter2D(Collider2D collision)
{
GameObject collider = collision.gameObject;
Debug.Log("Collided");
//checks to see if the block is correct;
if (collider.GetComponent<BlockBehavior>().correct)
{
Destroy(collision.gameObject);
Score++;
}
else
{
this.gameObject.GetComponent<Movement>().gameOver = true;
}
}
}