Title pretty much sums up the question. I’m loading assets via LoadObject in C++. Everything works fine in editor but falls apart when I package the game.
I only found references to needing to use FPaths in my searching though the solutions I’ve tried (namely: FPaths::ConvertRelativeToFull(FPaths::GameContentDir()) and FPaths::GameContentDir() ) haven’t worked out.
Here’s the code I’m currently using:
FString thePath = FPaths::GameContentDir();
//#if WITH_EDITOR
cLoginMenu = LoadObject<UClass>(UUserWidget::StaticClass(), TEXT("/Game/Blueprints/Widgets/W_LoginScreen.W_LoginScreen_C"));
cLoadingScreen = LoadObject<UClass>(UUserWidget::StaticClass(), TEXT("/Game/Blueprints/Widgets/W_LoadScreen.W_LoadScreen_C"));
/*#endif
#if !WITH_EDITOR
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Yellow, thePath.Append(TEXT("Blueprints/Widgets/W_LoadScreen.W_LoadScreen_C")));
cLoginMenu = LoadObject<UClass>(UUserWidget::StaticClass(), *thePath.Append(TEXT("Blueprints/Widgets/W_LoginScreen.W_LoginScreen_C")));
cLoadingScreen = LoadObject<UClass>(UUserWidget::StaticClass(), *thePath.Append(TEXT("Blueprints/Widgets/W_LoadScreen.W_LoadScreen_C")));/
#endif*/
the uncommented code is the original, working code In-Editor while the commented code are various attempts at fixing the problem.
Any advice would be appreciated,
Thanks
Edit:: I should clarify that the game correctly packages, it just fails to get these classes loaded.
Oh, and I’ve also read somewhere about pak files creating issues so I currently have those turned off while I figure out what’s happening.