Why can't FObjectFinder be used outside constructor

I’m trying to find a workaround for this, but I can’t seem to. So I’m just curious

Why can’t ConstructorHelpers::FObjectFinder be used outside a UCLASS constructor?
USTRUCT constructors can’t hold them as well

P.S. don’t answer cuz it’s ConstructorHelpers::FObjectFinder; I want the technical reason

By looking at the code:


It is designed to run early at engine initiation state, when Class Default Objects (CDOs) are created, also asset needs to be preloaded first. In other words it requires special treatment.

This might help you out on dynamic asset loading and refrenceing:

UObjectLibrary is for runtime asset interatcion:

I find this in search for anwser, this will help you out, you just need ot change functions a little as it is Blueprint example.

If any asset is loaded already (for example you already have it on level or used by object on the level), you should able to find it with normal TObjectIterator

1 Like

If you want to load a UClass* latently (outside the constructor), I found this to work: