【UE4_C++】打开Windows资源管理器导入文件打包Shipping解决方法

此篇博客介绍了如何在UE4项目中使用B站Up主的教程,通过替换特定模块并实现代码,解决Shipping下打开系统窗口崩溃的问题,并提供插件下载和使用步骤。着重讲解了如何正确引用和使用DesktopPlatformEx模块来打开文件对话框播放视频。

为笔记用来做一点补充

原文中插件怎么用第二步替换完模块名称以后

#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[] {  });

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值