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
Comment
Answer by Landern · Apr 18, 2017 at 02:22 PM
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.
change:
if (collisionInfo.collider.tag = "Cylinder") // single equals is assignment, which does not return true/false
to
if (collisionInfo.collider.tag == "Cylinder") // double equals compares and returns true or false