I declared a variable in a script:
private int count;
Init it at Awake() method:
void Awake()
{
count = 1;
}
Keep checking an print the value of it:
void Update ()
{
Debug.Log(count);
}
Then declared a method to change the value of this variable:
public void ChangeValue()
{
count = 2;
Debug.Log("button has being pressed!");
Debug.Log(count);
}
Then create a button to call this method to change the value, the value that print out in update() method does not change without any error.
Here is the log:

No matter how many times I pressed the button, the count variable in Update() method is still "1".
How can I update the variable value inside the Update() method?


