So I have a List of Integers and a List of List Objects.
Basically I am just trying to compare the two while in a for loop but for some strange reason I get the error;
“ArgumentOutOfRangeException: Argument is out of range”…
When I debug the two return values I am receiving numbers, so they can’t be null or non-existent ?
public List<List<Object>> listOfLists= new List<List<Object>>();
List<int> intList;
....
if(intList.Count == 0)
{
intList.Add (new int()); // Tried this and something similar with listOfLists to make sure there is definitely content within them. Debug.Log with a ToString() revealed that they do have values.
intList[i] = 1;
}
if(listOfLists.Count != intList[i]) // Error points to this..
{
}
So yeah. Please if someone could help me I would be thankful.
Sorry if this suggestion doesn’t really work, but have you tried i-1? Seeing only so little doesn’t give me much room to do much gues- I mean, thinking work
I’m sure I tried something -1 as I have this error on a few instances on using Count… I’ll give it another go thanks - any other suggestions are welcome though as I am a bit doubtful this’ll work.
Uuugh. This is really fustrating, sometimes it comes up with this error and sometimes it doesn’t. I mean seriously, how can Debug.Log(intList.Count.ToString()); create an error ??
I’m going to take a completely different approach to this if I cannot figure it out tonight. Thanks for the effort but don’t worry about it. I would post my code but its all over the place and the error jumps between sections exactly like what I linked at the start of the post, only it happens in loads of different places across 300 lines of code.
Here … Sorry if there is a rogue curly bracket somewhere. I cut out only the relevant code that I’m working on which is giving me an issue. What I’m basically trying to do is be able to dynamically create a Master windows which hold a int each, changing that int will give GameObject Boxes/windwos that you can drag and drop onto.
So
MasterWindowAmount = 2 would give you 2 entries in ListOfWindows and the ability to set an int which affects each of those entires during the creation as they both refer to i variable on the for loop.
Changing those int variables > 0 will create GameObject inspecter boxes… That’s the idea anyway.
// Code removed because it was wrong and buggy
// Don't want someone finding this page and trying to use it and having the pains I had with it ..
// Current working (ish) version still buggy in some places and very messy so will not post yet.