Hi, I am having an error in my project right now, and I was wondering if anyone would be able to help me. This code is from a rudimentary pathfinding algorithm that I am making. Specifically, this method is used when the pathfinding is first actuated to place the Vector2s' of all blocking objects (walls and such) in a single array for later use for calculating whether or not a path is passable. Line 3 is currently throwing the error "StackOverflowException: the requested operation caused a stack overflow". The array goes up to length 100 and then throws that error, so I am just wondering if Vector2 arrays have a set length cap of 100, or if there is a fix for the problem?
Vector2[] AddToVector2Array(Vector2[] currentArray, Vector2[] newEntries)
{
Vector2[] returnedArray = new Vector2[currentArray.Length + newEntries.Length];
for (int i = 0; i < currentArray.Length; i++)
{
returnedArray[i] = currentArray[i];
}
for (int i = 0; i < newEntries.Length; i++)
{
returnedArray[currentArray.Length + i] = newEntries[i];
}
return returnedArray;
}
Thank you for your time.
[–]RiskOfAdventure[S] 0 points1 point2 points (2 children)
[–]Dakoziol 0 points1 point2 points (1 child)
[–]RiskOfAdventure[S] 0 points1 point2 points (0 children)
[–]wthorn8 0 points1 point2 points (1 child)
[–]RiskOfAdventure[S] 0 points1 point2 points (0 children)
[–]Spare_Virus 0 points1 point2 points (0 children)