Hello!
I’m trying to create a system to load objects into the game based on string variables. What I’m trying to do is that i have a collection of blueprints inside a certain folder and use function StaticLoadClass to load those blueprints during runtime.
**However, ** every time I try to load any blueprint’s class(not just of those I want to spawn) the StaticLoadClass always only results in a warning like: LogUObjectGlobals:Warning: Failed to find object 'Class None./Game/test’
It might be worth noting that I did also try to load it from the full asset reference (not just the path) with the same result. I’m 100% sure that the blueprint is where I’m trying to load it from since StaticLoadObject can find it fine.
Here’s the code for loading the classes
UClass* UFunctionLibrary::StaticLoadAssetClass(FString path)
{
UClass* asset = StaticLoadClass(AActor::StaticClass(), NULL, *path);
if (asset)
{
return asset;
}
UE_LOG(ZeroLoad, Error, TEXT("Failed to load class at path: %s (not found)"), *path);
return nullptr;
}
Does this function work only on C++ classes or am I doing something wrong?
I can temporarily bypass the function by loading the blueprint asset and then getting its generated class but the original method would be a better solution
Thanks for any help!