Error CS0201 Can't get true false to work.

using UnityEngine;
using System.Collections;

public class Fridge : MonoBehaviour {
private bool Open = false;

    void Update () {

        if (Input.GetMouseButtonDown(0) && Open == false)
        {
            animation.Play("Opening");
            animation.Play("Opened");
            Open == true;
        }
        else if ((Input.GetMouseButtonDown(0)) && Open == true )
        {
            animation.Play("Closing");
            animation.Play("Closed");
            Open == false;
        }
}
}

I keep getting the error “error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement”. Now I’ve googled this error, but cannot find a solution to the true and false issue?

If you assing true to a variable, you need one =, if you compare the variable with a value, you need two ==. That means at line 13 and 19, there should only be one =.

using UnityEngine;
using System.Collections;

public class Fridge : MonoBehaviour {
private bool Open = false;

    void Update () {

        if (Input.GetMouseButtonDown(0) && Open == false)
        {
            animation.Play("Opening");
            Open = true;
        }
        if ((Input.GetMouseButtonDown(0)) && Open == true )
        {
            animation.Play("Closing");
            Open = false;
        }
}
}

Awesome, thank you! I got it to work, but now the whole thing plays out at once. Any idea how I make it to where I click once, it opens, and if I click again, it closes?

Never mind, I got it. I placed it with “else if”. Thanks for the help!