I am trying to make an ID counter for icons and insert it in a list and I am getting this error for some reason, I have made sure that the ID counter is accessible, and that the code works until the line that inserts the icon.
[HideInInspector] public int idCounter = 0
[HideInInspector] public List<Icon> Icons = new List<Icon>(1);
public void ConfirmCurrentIcon()
{
Debug.Log(idCounter);
Icons[idCounter] = icon;
idCounter++;
Debug.Log(idCounter);
}[/code]
This is the console:
If further information is required please ask for it
Thanks in advance:)
