I have a script that changes the value of someBool depending on what mouse button was clicked and what value someBool has. But for some reason the value of someBool doesn’t change. As far as I can tell these if statements should be valid. Any idea what is wrong with this script?
using UnityEngine;
using System.Collections;
public class SomeScript : MonoBehaviour {
public bool someBool;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void OnGUI () {
if (GUI.Button(new Rect(10, 70, 250, 30), "Click to Change someBool's value")){
if(Input.GetMouseButtonUp(0)){
if(someBool = false){
someBool = true;
}
else if(someBool = true){
someBool = false;
}
}
else if(Input.GetMouseButtonUp(1)){
if(someBool = true){
someBool = false;
}
else if(someBool = false){
someBool = true;
}
}
}
GUI.TextArea(new Rect(10, 50, 40, 20), someBool.ToString(), 200);
}
}