当前位置: 首页 > article >正文

UE5 移植Editor或Developer模块到Runtime

要将源码中的非运行时模块移植到Runtime下使用,个人理解就是一个解决编译报错的过程,先将目标模块复制到项目的source目录内,然后修改模块文件夹名称,修改模块.build.cs与文件夹名称保持一致

修改build.cs内的类名 ,每个模块都要修改 

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class RTDesktopPlatform : ModuleRules
{
	public RTDesktopPlatform(ReadOnlyTargetRules Target) : base(Target)
	{
	    PrivateIncludePaths.Add("RTDesktopPlatform/Private");
	    
		PrivateDependencyModuleNames.AddRange(
			new string[] {
				"Core",
				"ApplicationCore",
				"Json"
			}
		);
		
		if (Target.IsInPlatformGroup(UnrealPlatformGroup.Linux))
		{
			PrivateIncludePathModuleNames.AddRange(
				new string[] {
					"RTSlateFileDialogs",
				}
			);
			
			DynamicallyLoadedModuleNames.Add("RTSlateFileDialogs");

			AddEngineThirdPartyPrivateStaticDependencies(Target, "SDL2");
		}

		UnsafeTypeCastWarningLevel = WarningLevel.Error;
	}
}
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class RTSlateFileDialogs : ModuleRules
{
    public RTSlateFileDialogs(ReadOnlyTargetRules Target) : base(Target)
    {
        PrivateIncludePaths.AddRange(
            new []
            {
                "RTSlateFileDialogs/Private",
            });
        PrivateDependencyModuleNames.AddRange(
            new string[] {
                "Core",
                "CoreUObject",
                "InputCore",
                "Slate",
                "SlateCore",
                "RTDirectoryWatcher",
            }
        );
    
        PrivateIncludePathModuleNames.Add("TargetPlatform");
    }
}
// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class RTDirectoryWatcher : ModuleRules
{
	public RTDirectoryWatcher(ReadOnlyTargetRules Target) : base(Target)
	{
		PrivateIncludePaths.Add("RTDirectoryWatcher/Private");
		PrivateDependencyModuleNames.Add("Core");
		UnsafeTypeCastWarningLevel = WarningLevel.Error;
	}
}

刷新项目后修改项目.uproject文件,添加启动模块

{
	"FileVersion": 3,
	"EngineAssociation": "{415CA20E-4C6F-969C-0B60-4DBEE9818054}",
	"Category": "",
	"Description": "",
	"Modules": [
		{
			"Name": "MyRunImpFBX",
			"Type": "Runtime",
			"LoadingPhase": "Default",
			"AdditionalDependencies": [
				"Engine"
			]
		},
		{
			"Name": "RTDesktopPlatform",
			"Type": "Runtime",
			"LoadingPhase": "Default"
			
		},
		{
			"Name": "RTSlateFileDialogs",
			"Type": "Runtime",
			"LoadingPhase": "Default"
			
		},
		{
			"Name": "RTDirectoryWatcher",
			"Type": "Runtime",
			"LoadingPhase": "Default"

		}
		
	],
	"Plugins": [
		{
			"Name": "ModelingToolsEditorMode",
			"Enabled": true,
			"TargetAllowList": [
				"Editor"
			]
		}
	]
}

 在项目build.cs中添加依赖项

// Copyright Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class MyRunImpFBX : ModuleRules
{
	public MyRunImpFBX(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[]
		{
			"Core",
			"CoreUObject",
			"Engine",
			"InputCore",
			"EnhancedInput",
			"HeadMountedDisplay",
			"Slate",
			"SlateCore",
			"UMG",
            "RTDesktopPlatform",


        });

		PrivateDependencyModuleNames.AddRange(new string[] {  });
	}
}

此时编译会有很多错误,后面就是解决报错的过程,过程中删除了报错的DesktopPlatform_API,打包后模块丢失,修改了模块的IMPLEMENT_MODULE( FDesktopPlatformModule, RTDesktopPlatform );后解决问题,


http://www.kler.cn/a/447224.html

相关文章:

  • 学工管理系统-职校信息化管理平台
  • leetcode45.跳跃游戏II
  • 厦门凯酷全科技有限公司短视频带货可靠吗?
  • lpips使用笔记
  • 彻底认识和理解探索分布式网络编程中的SSL安全通信机制
  • 【TF-IDF】Hugging Face Model Recommendation System
  • 强光防卫电筒TX-8610
  • Matlab个性化绘图第5期—三维分层柱状图
  • 播放端标注叠加方案
  • 高并发服务器实现总结目录
  • VUE3+django接口自动化部署平台部署说明文档(使用说明,需要私信)
  • Cadence学习笔记 9 器件封装匹配
  • OpenHarmony 3.2 网卡获取ip地址缓慢分析
  • [创业之路-202]:任正非管理华为的思想与毛泽东管理党、军队、国家的思想的相似性与差异性
  • 高效SQL优化技巧:解决常见性能问题的实战方案
  • Spring 6 实现 Bean 异步初始化,减少项目启动时间
  • JAVA包装类变量赋值是会新创建对象实例
  • 【LeetCode】227、基本计算器 II
  • C#中方法参数传值和传引用的情况
  • AI大模型与传统模型的六大区别
  • feign调用远程服务返回值的一种处理办法
  • PostgreSQL中使用PL/pgSQL开发函数
  • Android Studio AI助手---Gemini
  • 前端处理流式数据(SSE服务)
  • 单北斗+鸿蒙系统+国产芯片,遨游防爆手机自主可控“三保险”
  • 基于预测反馈的情感分析情境学习