Where can I propertly define the default value of a property for my c++ Actor?

I have a C++ Actor with a property holding a TArray of TSubclassOf

I am populating that via C++ code using the Asset Registry Module which I have working but it is currently placed in my class’ constructor.

The issue with that: It runs repeatedly (any time this class gets constructed), and afaik will work once packaged because the Asset Registry Module will no longer be available.

Is there an event or place I can put this generation code so that it will happen on loading editor and persist into a packaged build?

Thank you. And for context I have many gaps in my understanding of these types of mechanisms of UE but will gladly research them if pointed in the right direct, but I haven’t been able to find a thread to follow on this yet.

Asset Registry should work after package as it is runtime module, you can tell header file location:

Runtime/AssetRegistry/Public/AssetRegistryModule.h

If it was “development” or “editor” that would mean that module is avable in shipping build

I also don’t know why you need asset registry to populate UClass* array, information about classes are held in reflection system, this will allow you to access both C++ and Blueprint classes, while in asset manager you can only get blueprints as far as i know. You can search for UClass* using UObjectIterator and filter down:

You should do this once on game start up as it is expensive process. You should also avoid doing that in constructor as not all UClass may be loaded during CDO creation.