I'm new to lists and arrays, so I'm not sure what's happening here. I understand the concepts of arrays/lists in general, but I'm trying to add new values upon a key press. The problem is that it seems to be adding it to the list, but when I'm using "myValue.Count >= someNumber" it doesn't return the max value even though it's well over it. If I were to use a for loop however, it works but I'm trying to add it by increments of one and not in once instance. I tried searching this(as well as MSDN) but I couldn't find a solution. Any help would be appreciated. Edit: For those familiar with Unity, it's being called in the "Update" method.
void Numbers()
{
var keyDown = Input.GetKeyDown("k");
List<newNumber> numbers = new List<newNumber>();
if (keyDown)
{
numbers.Add(new newNumber(1));
Debug.Log(numbers);
}
if (numbers.Count >= 10)
{
Debug.Log("You reached 10!");
}
class newNumber
{
public int _num = 1;
public newNumber(int num)
{
_num = num;
}
}