# In random loop button dont work properly

I have this code to add 10 point if someone click the button and change the question. But it returns 10 point every time. I want to make it 10,20,30,40... etc.

IEnumerator TransitionToNextQuestion() {

yield return new WaitForSeconds (timeBetweenQuestions);
}

}

public void ButtonDown() {
Debug.Log (point);
StartCoroutine (TransitionToNextQuestion());

}


That is because ints are value types, this means they are located in the stack, which, on the other hand, classes are reference types, so they are located in dynamic memory. In a nutshell: when you have a class, you have its memory's reference, when you have a value type, you have its value, but not its memory reference.

When you pass a value type as a parameter and you modify it inside a function, it will not be modified, you could use a ref or out modifier in your parameter instead, with that, you also pass the location in memory of that value type. Or you could do a wrapper class.

Example:

public class Example : MonoBehaviour
{
int integer;

void Start()
{