Hello,
I have two cubes and both are rigid bodies. I want to detect collision, but for some reason nothing gets printed on the console. This is my code

public class ChangeColorOnHit : MonoBehaviour 
{       
    void  OnCollisionEnter(Collision col)
    {
        if (col == null)
            Debug.Log("Null");           
        else
            Debug.Log(col.gameObject.name);
    }
}

those are the inspector tabs of my objects

And if someone is wondering this is the “Move” script of the Red Cube

public class Move : MonoBehaviour
{
    public float moveSpeed;   
    
    // Update is called once per frame
    void Update()
    {       
        transform.Translate(moveSpeed * Input.GetAxis("Horizontal") * Time.deltaTime, 0f,
             moveSpeed * Input.GetAxis("Vertical") * Time.deltaTime);
    }
}

Honestly, this should work. Um, as an idea: I would delete those two cubes and just remake them. I have seen some wonky stuff happen sometimes. Or restart Unity may help too.

It was late at night yesterday. And today I started my computer and it is working :smiley: