I’m following a tutorial ‘How to make a Video Game in Unity - COLLISION (E05) - YouTube’ and I’ve gone to disable the player movement with the code “movement.enable = false;” and it gives me the error message:
“‘PlayerMovements’ does not contain a definition for ‘enable’ and no accessible extension method ‘enable’ accepting a first argument of type ‘PlayerMovements’ could be found (are you missing a using directive or an assembly reference?”
What can I do to resolve this?
full code:
using UnityEngine;
public class PlayerCollision : MonoBehaviour
{
public PlayerMovements movement;
void OnCollisionEnter(Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Barrier")
movement.enable = false;
}
}