- Home /
What's the proper way to see if a Vector3 List index is null?
I'm actually using a jagged list of Vector3's, so I don't always know if the second dimension is null or not.
Testing for Vector3 == null obviously won't work, because it's initialized as Vector3.zero.
So my questions is- what's the proper way to test an index of a list to see if it contains a Vector3? I figure I could always catch the ArgumentOutOfRangeException, but that seems hacky and wrong.
Any ideas?
Answer by CHPedersen · Jun 12, 2011 at 08:10 PM
If you worry about "counting too far", you could always check against the length of each of the arrays in your jagged array. If the index is greater than or equal to the array's length, don't index into it, I guess?
perfect. Don't know why I didn't think of that- my head is swim$$anonymous$$g with all of the recursive stuff I've been doing today ;)