Collider CS0131 issue

I’m new in programming, started only yesterday. My goal is to disable player movement when it hits a certain object, but i keep getting error cs0131. This is the code I’m using using:

public Judėjimas movement; //reference to movement
void OnCollisionEnter (Collision collisionInfo)
    if (collisionInfo.collider.tag = "Cylinder")
        movement.enabled = false;

Please help

It’s because you’re using a single equals sign which is used for assignment and not the double equals operator which is a comparison.


if (collisionInfo.collider.tag = "Cylinder") // single equals is assignment, which does not return true/false


if (collisionInfo.collider.tag == "Cylinder") // double equals compares and returns true or false