The old ‘Array index out of bounds’! I’ve danced with this one myself. This error basically occurs when you’re trying to access/grab something from an address that doesn’t belong to the array. For instance if you recently added/removed a file from your project folder and didn’t remove it from inside the project in UE, it will give that error. Basically, it’s calling for something that doesn’t exist. I’d start with backtracking and trying to think of any changes you made just prior to this popping up. That’ll usually lead you to the culprit. I hope that helps explain it some! Also, here’s a post for reference that explains it a bit more: Assertion failed (Index >= 0) & (Index < ArrayNum)
I recently had a similar question solved by jwatte. he said:
“You might want to attach to the editor process from Visual Studio. You will then get a complete stack trace and debugger at the point of crash, where you can easily see where the problem is.
Or you can even launch the editor from the debugger.”
I didnt know what he meant by “attach to the editor process” so I just started launching the editor from the debugger which has been working
It’s hard to tell with the limited information that you’ve given, but I am pretty sure the error comes from a point further up in the call stack
In your screenshot you can see that the label can’t be read, which leads me to believe that this is not valid
So somewhere previously in the callstack something was attempted to be read but was out of bounds
And since arrays are nothing but memory addresses, the compiled program doesn’t actually know about the size of the array (this is what the TArray wrapper does, and asserts if you are trying to access something out of bounds), and will just do what you tell it, so if you try to access the 5th element of an array with 4 elements, it will try to do that, and will try to read that memory as what you told it it is, but will fail. So it can continue executing code, until it needs to access something that would be part of the data structure of the array element
You can also wrap the relevant functions in your callstack with PRAGMA_DISABLE_OPTIMIZATION and PRAGMA_ENABLE_OPTIMZATION which might allow you to get more information since the code won’t be optimized and all variables will be available and lines won’t be skipped
But I would say go up your callstack until you find a call that’s being made on an invalid address
I will look into pragma_disabled_optimization thank you! About the label error I tried clicking it and it took me to like some deep windows hex code script so im just going to pretend i didnt see that
From this screenshot it really looks like this is not a valid AHUD object, so my guess is that in a previous place in the call stack you are trying to access the HUD from an array of AHUD?
That’s fine, but the code in your original post’s screenshot, where is that called from? I think that’s where it fails
If you don’t mind post a screenshot of the callstack after crashing
previousTurnOrIntersectionPosition is being set from an array but that array cant possibly go out of bounds Ive checked and double checked, and youd think i tried to set the value for a FVector2D data type variable to be something that is not an FVector2D it would cause an error by itself
by wrapping the relevant code in PRAGMA_DISABLE_OPTIMIZATION the debugger was able to isolate the exact line causing the errors. Thank you zeaf! it was very good talking to you