What am I doing wrong here? OnCollisionEnter not working!

I’m fairly new to unity, so I’d like to apologize if this question sounds stupid. I’m trying to make pac-man in 3D as my first unity project and things have been going really smooth. (I’m almost done, in fact!)

All I need to add is a way for the player (pac man) to detect if a ghost is touching it . Im trying to use OnCollisionEnter as a way to make this work. Here is my code:

using UnityEngine;

public class Colissionchecker : MonoBehaviour
{
    void OnCollisionEnter(Collision collsion)
    {
        if (collsion.gameObject.tag == "Ghosts")
        {   
            //If the GameObject has the same tag as specified, output this message in the console
            Debug.Log("Colidded");
        }
    }
}

The ghosts are tagged as "Ghosts" and they have sphere colliders set on Is Trigger. They also have RigidBody components. I don’t get any console errors but whenever I touch a ghost, nothing pops up in the debug log. Someone please help me!

I think your error is that you set the collider to isTrigger. Try removing that.

Go through my troubleshooting physics messages resource and you should find your culprit

For triggers use OnTriggerEnter