Download

Is there any reason for vectors pointers to lose their value?

I’m using pointers to FVectors to change them once and have their location affect multiple places.
Each time I add four vectors to an array, then I assign to different objects pointers to the vectors inside that array.
But sometimes it gets messed up.
Here I log the last vectors I get each four mouse clicks ( I’m using LineTrace to get the vectors ( locations )).
b98b8714f088ecfa69e06f502c1d7b9d52a959c4.png
What can make pointers lose their sh*t?

This is like the vectors in the array are changing their address without updating the pointers.

Without your code this question cannot be answered. But if you’re using a pointer to a FVector, then the Garbage Collector might have eaten it.

Thanks, I’v changed it to use array indexes instead of pointers and it fixed the problem.