c# problem with changing value with button click

i have found a weird bug or im making a mistake somewhere. i’ll explain my problem here:
i made a bool in my public class for example"bool easy;“. then i wrote in void Start()“easy = false;”. i also did add in void update() print to control it"print(easy)”. i also have a NGUI button called EasyButton and it works so there is no problem with the button. here the code of the button:“public void EasyButton(){ easy = true; }” but when i run the game and check the print 20% says true and 80% says false. i really dont know why and how its possible that why i think it is a bug.
also sorry for my bad english.

an example of the code:
bool easy;

void Start(){
easy = false;
}

void Update(){
print(easy);
}

public void EasyButton(){
easy = true;
}

ill send down below the code in my script so maybe it is for you guys easier to find a solution:

using System;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class lvl7script : MonoBehaviour {
    public bool Jump = false;
    public bool Grounded = true;

    public bool left;
    public bool mid;
    public bool right;
    public bool pressed;

    GameObject Panel;
    public float speed;

    bool easy;
    bool normal;
    bool hard;

    // Use this for initialization
    void Start () {
        Time.timeScale = 0;
        Panel = GameObject.Find("Panel");
        easy = false;
        normal = false;
        hard = false;
    }

    // Update is called once per frame
    void Update() {
        if (Application.loadedLevel == 7)
        {
            if (Time.timeScale == 1)
            {
                print(easy);
                print(normal);
                print(hard);
                if (easy)
                {
                    speed = 0.3f;
                    Panel.GetComponent<Canvas>().enabled = false;
                }
                if (normal)
                {
                    speed = 0.6f;
                    Panel.GetComponent<Canvas>().enabled = false;
                }
                if (hard)
                {
                    speed = 0.9f;
                    Panel.GetComponent<Canvas>().enabled = false;
                }
                //controls
                transform.Translate(0, 0, speed);
                transform.Translate(0, Time.deltaTime, 0, Space.World);

                //movement from 1 to other lane
                if (mid == true && Input.GetKeyDown(KeyCode.LeftArrow) && !pressed)
                {
                    transform.position = new Vector3(-5, (transform.position.y), (transform.position.z));
                    mid = false;
                    left = true;
                    right = false;
                    pressed = true;
                }
                if (mid == true && Input.GetKeyDown(KeyCode.RightArrow) && !pressed)
                {
                    transform.position = new Vector3(5, (transform.position.y), (transform.position.z));
                    mid = false;
                    left = false;
                    right = true;
                    pressed = true;
                }
                if (left == true && Input.GetKeyDown(KeyCode.RightArrow) && !pressed)
                {
                    transform.position = new Vector3(0, (transform.position.y), (transform.position.z));
                    mid = true;
                    left = false;
                    right = false;
                    pressed = true;
                }
                if (right == true && Input.GetKeyDown(KeyCode.LeftArrow) && !pressed)
                {
                    transform.position = new Vector3(0, (transform.position.y), (transform.position.z));
                    mid = true;
                    left = false;
                    right = false;
                    pressed = true;
                }
                if ((Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow)) && pressed)
                {
                    pressed = false;
                }

                //jump control
                if (Jump == false && Input.GetKeyDown("up"))
                {
                    Vector3 jump = new Vector3(0.0f, 400.0f, 0.0f);
                    GetComponent<Rigidbody>().AddForce(jump);
                    Jump = true;
                    Grounded = false;
                }
                //stay on 1 lane 
                if (mid == true && transform.position.x != 0)
                {
                    transform.position = new Vector3(0, (transform.position.y), (transform.position.z));
                }
                if (left == true && transform.position.x != -5)
                {
                    transform.position = new Vector3(-5, (transform.position.y), (transform.position.z));
                }
                if (right == true && transform.position.x != 5)
                {
                    transform.position = new Vector3(5, (transform.position.y), (transform.position.z));
                }
            }
        }
    }

    //collision for grounded
    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.name == "Ground")
        {
            Grounded = true;
            Jump = false;
        }
    }
    public void EasyButton()
    {
        Time.timeScale = 1;
        easy = true;
    }
    public void NormalButton()
    {
        Time.timeScale = 1;
        normal = true;
    }
    public void HardButton()
    {
        Time.timeScale = 1;
        hard = true;
    }
}

here is a screenshot of the print result: Screenshot by Lightshot

Well i found a solutin after some days of research. i knew there was something wrong with attaching the script to multiple gameobjects. i finally found a solution. i was slovenly with the code and made mistakes with the if statements and the debug log(print). i saw when i run the game and pause it. that only the components of the button which i pressed did change but the other attached buttons didnt so i added this:
using System;
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class lvl7script : MonoBehaviour
{
    GameObject Panel;
    GameObject Ebutton;
    GameObject Nbutton;
    GameObject Hbutton;
 
    public int difficulty;

    void Start()
    {
        Ebutton = GameObject.Find("EasyButton");
        Nbutton = GameObject.Find("NormalButton");
        Hbutton = GameObject.Find("HardButton");
    }

    void Update()
    {
                Debug.Log(Hbutton.GetComponent<lvl7script>().difficulty);
                if (Ebutton.GetComponent<lvl7script>().difficulty == 1)
                {
                    speed = 0.5f;
                    Panel.GetComponent<Canvas>().enabled = false;
                }
                if (Nbutton.GetComponent<lvl7script>().difficulty == 2)
                {
                    speed = 1f;
                    Panel.GetComponent<Canvas>().enabled = false;
                }
                if (Hbutton.GetComponent<lvl7script>().difficulty == 3)
                {
                    speed = 1.5f;
                    Panel.GetComponent<Canvas>().enabled = false;
                }
    }
    public void EasyButton()
    {
        Time.timeScale = 1;
        difficulty = 1;
    }
    public void NormalButton()
    {
        Time.timeScale = 1;
        difficulty = 2;
    }
    public void HardButton()
    {
        Time.timeScale = 1;
        difficulty = 3;
    }
}

i tried in the if statement to only look to the gameobject component and that fixed it.

Actually your code is OK, for the most part.
But your doing something wrong in terms of basic debug principles.

If you are doing this:

          print(easy);
          print(normal);
          print(hard);

Now, you are expecting to see what is going on in your code by trying to debug with those prints. How would you be able to actually KNOW which one of those prints is the variable you are looking for , IF you are currently printing "unknown’ data into the log?.

Try this:

Debug.Log("Easy :" + easy);
Debug.Log("Normal:" + normal);
Debug.Log("Hard :" + hard);

First thing you need to do is turn off the “Collapse” option in your console so you can see what order these things are happening.

Also check that the script isn’t on more than one active gameobject and/or add the gameobject’s name to the debug.log so you know which one is logging what if there are multiple instances.

And note that the way you’re using those easy/hard flags looks dodgy because they can all end up set to true. To make them mutually exclusive you either want to set the others to false whenever you set one to true or (better) use an enum.