public class TEST : MonoBehaviour {
public List<int> numbers = new List<int>() { 1, 2, 3 };
public void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
Test();
}
}
public void Test()
{
foreach (int number in numbers)
{
Debug.Log(number);
}
}
}
Currently when I press the spacebar all the numbers appear in the console. What I want to happen is that only one number appear in the console I.e if I press spacebar once then the console says 1, if I press spacebar again then the console says 2 and finally when I press it a third time it says 3.