Hi, im haveing trouble with my script unity says it wont load. This script stops player from moveing when it hits something.

using UnityEngine;

public class PlayerCollision : MonoBehaviour
{

public playermovement movement;     // A reference to our PlayerMovement script

// This function runs when we hit another object.
// We get information about the collision and call it "collisionInfo".
void OnCollisionEnter(Collision collisionInfo)
{
	// We check if the object we collided with has a tag called "Obstacle".
	if (collisionInfo.collider.tag == "Obstacle")
	{
		movement.enabled = false;   // Disable the players movement.
	}
}

}

You must name your class with the name of your script, otherwise it will not open in Unity:
181954-rename.png
Rename the script file to “PlayerCollision” and it should work.