I’m trying to use this code for my for loop to print out the days in the calendar:
void OnGUI()
{
for (i = 0; i < numOfDays + leadDays; i++)
{
if (dates*.dateOfMonth == 0)*
-
{*
-
labelInput = " ";*
_ GUI.Label(new Rect ( 25, i * 10 ,200,50), labelInput);_
-
}*
_ if (dates*.dateOfMonth >= 1)_
_ {_
_ labelInput = dates.dateOfMonth.ToString();
GUI.Label(new Rect ( 25, i * 10 ,200,50), labelInput);
}
}
}*
but I keep getting this error:
ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[Dates].get_Item (Int32 index) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
DatesDatabase.OnGUI () (at Assets/SCRIPTS/DatesDatabase.cs:147)
The code actually works fine but I keep getting this error and I’m worried that it might cause some bug later._