OnCollisionEnter, collider is the gameobject

Hi, I got a script with an OnCollisionEnter. When I print the name of the collider and the name of the gameobject, it is the same name. I attached the script to a player. In my scene i have a floor and walls. When I move the the cube around, every time it touches a different tile, it triggers the OnCollisionEnter ( as expected), however it says that the player is hit by player.

Here is my code:

 void OnCollisionEnter(Collision c)
    		print(collider.name + " " + transform.name);
    			var floor = collider.GetComponent<FloorPiece>();
    			renderer.material.color = floor.color;

You are assigning the collision as “c”, but are then referencing “collider” after that. You should be referencing “c”, as at the moment all you’re doing is checking the collider of the gameObject that the script is on.