Exposing Reserve() to Blueprints arrays

Yeah, I have blueprint I was working on that generates terrain for an open world. It uses arrays for each vert stored in a larger array of tiles. As far as performance goes I have know idea what it’s doing. :confused:

Speaking of which, how do struct arrays even allocate memory? Their components could be anything of any size. I would assume they should probably be avoided if possible but this is well beyond my knowledge.

This is a vital performance function when generating arrays with 500+ size per tick, cause memory reallocation kills the performance completely in blueprint only projects. Can it be exposed to blueprints in the near future?

It is possible to expose the function yourself. Though doing it might cause problems with Blueprint nativization and might not work in the future. See here: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1590531-implementing-a-custom-generic-array-function-for-blueprint-like-array-remove-requires-customthunk

If you wanna do it anyway: You need a class that inherits from FScriptArray (or implement everything in there on your own), probably want a copy of FScriptArrayHelper that works with your child of FScriptArray.

Then see KismetArrayLibrary.h and my link above on how to create generic array functions.