【UE4_C++】打开Windows资源管理器导入文件打包Shipping解决方法
- 文中功能实现代码来自B站Up主我是一只好蛋YEAHUE4 C++小功能教程系列-P5 调取Windows文件管理器播放视频_哔哩哔哩_bilibili
- 解决方法文章原文链接UE4 Shipping下打开系统窗口崩溃问题 附插件下载地址_u011718663的博客-CSDN博客
为笔记用来做一点补充
原文中插件怎么用第二步替换完模块名称以后
#include "MyBlueprintFunctionLibrary.h"
#include "DesktopPlatformEx/Public/IDesktopPlatformEx.h"
#include "DesktopPlatformEx/Public/DesktopPlatformModuleEx.h"
bool UMyBlueprintFunctionLibrary::OpenWindowsMovie(TArray<FString>& FilePath)
{
FString ExtensionStr = ".";
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModuleEx::Get();
bool bOpen = DesktopPlatform->OpenFileDialog(nullptr, TEXT("选择文件"),FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()), TEXT(""), *ExtensionStr,EFileDialogFlags::None, FilePath);
if (!bOpen)
{
return false;
}
else
{
return true;
}
return false;
}
要包含修改过名称的头文件
#include "DesktopPlatformEx/Public/IDesktopPlatformEx.h"
#include "DesktopPlatformEx/Public/DesktopPlatformModuleEx.h"
然后如原文一样将FDesktopPlatformModule::Get()替换成FDesktopPlatformModuleEx::Get()即可编译成功
最后贴一下.h和.Build.cs
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyBlueprintFunctionLibrary.generated.h"
/**
*
*/
UCLASS()
class OPENVIDEOTEST2_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable)
static bool OpenWindowsMovie(TArray<FString>& FilePath);
};
using UnrealBuildTool;
public class OpenVideoTest2 : ModuleRules
{
public OpenVideoTest2(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore","DesktopPlatformEx" });
PrivateDependencyModuleNames.AddRange(new string[] { });