We’ve been trying to make an options menu and just ran into a weird problem. MinRes and PlusRes both correspond to buttons that activate them. The idea is to have an int that stores a value for the desired option, and to have SetRes set the right resolution for that int. While working on it we decided to try Debug.Log to check that it was working. We found that it wasn’t. We first tried the button that was supposed to increment. trying it worked until we hit 4, at which point it went to 0 on the next push and then didn’t increment any more(according to the Debug.Log output). After this we tried the decrement button. With gave us 0 (again), 4, 3, 2, 1, 1, 1 and more 1’s after that. We’ve written other functions that work like this but we haven’t tried using debug.log in those functions.
public void MinRes()
{
resValue--;
if (resValue < 0)
resValue = 4;
SetRes (resValue);
}
public void PlusRes()
{
resValue++;
if (resValue > 4)
resValue = 0;
SetRes (resValue);
}
public void SetRes (int resValue)
{
Debug.Log (resValue);
}