hi, I am trying to implemente my own hot patch system for mobile game, but there has some issue when trying to load UMG assets.
I have two UMG assets under following folder:
MyProject\Content\NewWidgetBlueprint.uasset
MyProject\PersistentDownloadDir\NewWidgetBlueprint.uasset
I can dynamically load my widget under Content/ using following method:
{
FString PackagePathName = "/Game/NewWidgetBlueprint";
UWidgetBlueprint* test1 = Cast<UWidgetBlueprint>(StaticLoadObject(UWidgetBlueprint::StaticClass(), NULL, *PackagePathName));
UUserWidget* pUserWidget = nullptr;
if (test1) {
auto widget = CreateWidget<UUserWidget>(this, test1->GeneratedClass);
// do something
//widget->AddToViewport();
}
}
But how could I load UMG assets under FPaths::GamePersistentDownloadDir()?
I am trying following path, but load nothing, test2 always be nullptr.
{ // What is package name of GamePersistentDownloadDir?
FString PackagePathName = "/GamePersistentDownloadDir/NewWidgetBlueprint";
UWidgetBlueprint* test2 = Cast<UWidgetBlueprint>(StaticLoadObject(UWidgetBlueprint::StaticClass(), NULL, *PackagePathName));
UUserWidget* pUserWidget = nullptr;
if (test2) {
auto widget = CreateWidget<UUserWidget>(this, test2->GeneratedClass);
//widget->AddToViewport();
}
}
Any suggestion will be appreciated.