Is there any way to get a variable to an Actor prior to construction?

I am making use of DataTables. In order to get pointers to them in C++ you need to use ConstructorHelpers::FObjectFinder in the object’s constructor.

While I’ve been building my DataTable based solution, I hardcoded the subfolder my datatables are located but now I want to do it dynamically. Unfortunately, because it is not permitted to create these objects outside of a constructor script, I cannot pass an argument to my Actor to choose which datatables to spawn.

My workaround for now is simply to run through the whole set of subfolders and get all the tables and then select from a pointer array after construction, but I’d rather not build datatables I don’t need.

I have tried both SpawnActorDeferred and BeginDeferredActorSpawnFromClass and both still run the constructor script before my initialise function so I’d be open to suggestions.

You do NOT need to sue ConstructorHelpers for them at all. You can use GameInstance or GameSingleton to hold a UPROPERTY pointer to UDataTable*. Then you can make a BP of each one, and assign the correct DT to each property.

So i don’t really see what the issue is? but saying you NEED to use ConstructorHelpers is lack of knowledge.

“saying you NEED to use ConstructorHelpers is lack of knowledge.”
I think that rephrases what I said.

I know about the Blueprint method and it isn’t as efficient for me as my current solution. I’m using C++ to get the pointers to the DataTables I need, no matter how many are various folders, these are stored in an array at runtime.

It’s already automated to my liking, I just cannot narrow down the algorithm to a specific folder because of the construction limitations, which is what the question was really about.

For posterity, the TryLoad function has much the same behaviour as FObjectFinder prior to runtime.