Forum begins after the advertisement:
Start shopping now
-
public void LoadIncubator()
{
if (incubatorStatus.Count == 0) { return; }
foreach (IncubatorBase Egg in incubatorStatus)
{
Incubator incubatorToLoad = incubators[Egg.incubatorID]; // here I get an out-of-index message
if(incubatorToLoad.timeToGrow<=0)
{
incubatorToLoad.EggPre.SetActive(false);
incubatorToLoad.timeToGrow = 0;
}
else
{
incubatorToLoad.EggPre.SetActive(true);
incubatorToLoad.timeToGrow = needToGrowDays;
}
}
}
I can’t solve this problem
but when i debug list count is 0
` Debug.Log(Egg.incubatorID);
Debug.Log(incubators.Count);
Incubator incubatorToLoad = incubators[Egg.incubatorID];
I have two objects in the list
But when I debug, it tells me the count is 0
i have tow object in list
When I debug the list count is 0
Debug.Log(incubators.Count);
Incubator incubatorToLoad = incubators[Egg.incubatorID];
I fixed the problem. I had a script mount error
Hi Potato, glad you managed to fix the issue!
Hi Potato, can you click on the ArgumentOutOfRangeException item on the Console and screenshot or copy the message there?
Advertisement below: