BeginDestroy crashes and something wrong with index buffer

I am doing a bunch of stuff and Im allocating memory with new, then releasing it in a class with the function “Begin Desroy” but when it tries to go there it crashes.

I also have put something in the constructor of the class that is supposed to loop over indices fomr an index buffer.
The index buffer is strange because it goes from 0 → 22 thousand, it never repeats any digits.

In the loop it goes once maybe 2 times then it says array out of bounds.

I have no idea why I cant put a break point and hover over the values except the indices for some reason.

LOOP IMAGE

BEGIN DESTROY

image

Instead of calling CountTrianglesInsideNode() in the constructor i’d probably call it in another function like PostInitializeComponents():

https://docs.unrealengine.com/5.0/en-US/API/Runtime/Engine/GameFramework/AActor/


You need to call:

Super::BeginDestroy();

in your BeginDestroy function.

if it still doesn’t work, we’d need to see what CleanUp() does.

2 Likes