Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

issue with bool

Trying to make this statement work, i'm confused about the error code.

This is the line of code causing the error and the error code, any idea's?

if (Input.GetKeyDown("space") && col = true)

Assets\Scripts\Movement2d.cs(47,13): error CS0131: The left-hand side of an assignment must be a variable, property or indexer

Best Answer

  • WarpWarp Administrator
    Accepted Answer

    Change that line to this:

    if (Input.GetKeyDown("space") && col == true)

    Something to remember:

    1. = means that you are setting it to something.
    2. == means that you are checking if they are equal.

    Generally, an if statement will always use ==


Sign In or Register to comment.