Get variables from WorldGen in C++

tl;tr: How can i get varibles/arrays from the WorldGen/Blueprints in my BTService

I have a WorldGen that generates a world based on “blocks”, like siedler of catan. All blocks are stored in the array “WorldInfo”.

The WorldGenerator is made by my friend and he is not able to use C++. I want to write the AI in C++ and used the following guide: YOUTBE to start

Now im at the point where i am in the BTService and want to find the block where I’m on and want to iterate through the “WorldInfo” array to find the closest ressource block.

You need to use the reflection system to access Blueprint-defined variables from C++. I’ve posted an example (for a slightly more complex case) here.

wow thats a really a lot of code, i guess it will make more sense to define the Blueprint parent in C++ and then access it or do i miss something?

No I don’t think you’re missing anything. Defining the parent in C++ and having Blueprints inherit from this class is what I do whenever it is possible. Although, to be fair, quite a bit of the code in the example deals with setting values, which is worse than just getting values out of Blueprints. But still, while the reflection system is great to have, code using it is a lot more verbose and more difficult to debug than the straightforward solution, so, to repeat myself, in my projects I always define the basic structure of types in C++ and then use Blueprints to customize them.