Hello,
I am building a game for Win64 in 4.27. When playing the game the user can take highres screenshots. Normally these screenshots are saved in a pre-determined folder. I want to give the player the possibility to change this folder using FDesktopPlatformModule::OpenDirectoryDialog(). When playing in the editor (or as stand alone) everything works as expected. However, after packaging my game for shipping and run the game outside unreal, the game crashes at the moment it should open the OpenDirectoryDialog.
Include file
UFUNCTION(BlueprintCallable, Category = "Files|Dirs")
static void OpenDirDialog(const FString& DialogTitle, const FString& DefaultPath, FString& OutDirNames);
code
void UPBFunctionLibrary::OpenDirDialog(const FString& DialogTitle, const FString& DefaultPath, FString& OutDirNames)
{
if (GEngine)
{
if (GEngine->GameViewport)
{
void* ParentWindowHandle = GEngine->GameViewport->GetWindow()->GetNativeWindow()->GetOSWindowHandle();
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
if (DesktopPlatform)
{
//Opening the file picker!
uint32 SelectionFlag = 0; //A value of 0 represents single file selection while a value of 1 represents multiple file selection
DesktopPlatform->OpenDirectoryDialog(ParentWindowHandle, DialogTitle, DefaultPath, OutDirNames);
}
}
}
}
Does OpenDirectoryDialog only work in a non-shipping build?
Any help is appreciated.
Thanks,
Richard