添加模块在这篇文章里已经有详细的描述了:

https://orfeasel.com/creating-custom-modules/

但是这篇文章中少写了一个步骤:

最后要在

  <工程名>Editor.Target.cs

以及

  <工程名>.Target.cs

中做一点修改:

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

这里也要加入新的模块名称字符串。在4.21中实际测试发现只有这样才能正常编译。

下面举一例子,给一个名称为Test的工程添加一个叫做Ken的模块。

Ken.h:

#pragma once
#include "CoreMinimal.h"
#include "ModuleManager.h"
class FKen:public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};

Ken.cpp:

#include "Ken.h"
#include "Modules/ModuleManager.h"
#define LOCTEXT_NAMESPACE "FKen"
void FKen::StartupModule()
{
UE_LOG(LogTemp, Warning, TEXT("KEN MODULE Start"));
}
void FKen::ShutdownModule()
{
UE_LOG(LogTemp, Warning, TEXT("KEN MODULE End"));
}
IMPLEMENT_MODULE(FKen, Ken)
#undef LOCTEXT_NAMESPACE

Ken.Build.cs文件:

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class Ken : ModuleRules
{
public Ken(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core", // ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Test",
"Projects",
"InputCore",
"UnrealEd",
"LevelEditor",
"CoreUObject",
"Engine",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}

Test.Target.cs文件:

using UnrealBuildTool;
using System.Collections.Generic; public class TestTarget : TargetRules
{
public TestTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game; ExtraModuleNames.AddRange( new string[] { "Test","Ken" } );
}
}

TestEditor.Target.cs文件:

using UnrealBuildTool;
using System.Collections.Generic; public class TestEditorTarget : TargetRules
{
public TestEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor; ExtraModuleNames.AddRange( new string[] { "Test","Ken" } );
}
}

请使用手机"扫一扫"x

UE4添加模块的更多相关文章

  1. UE4物理模块(三)---碰撞查询(下)SAP/MBP/BVH算法简介

    在上一文中介绍了碰撞查询的配置方法: Jerry:UE4物理模块(三)---碰撞查询(上)​zhuanlan.zhihu.com 本篇介绍下UE4的各种零大小的射线检测,以及非零大小(带体积)的射线检 ...

  2. UE4物理模块(三)---碰撞查询(上)

    在前一文中介绍了如何在UE4中创建简单碰撞或者直接使用其mesh表示的复杂碰撞: Jerry:UE4物理模块(二)---建立物体碰撞​zhuanlan.zhihu.com 那么在拿到碰撞之后,就可以进 ...

  3. UE4物理模块(二)---建立物体碰撞

    在前文中介绍了什么是物理以及如何在UE4和PhysX中进行可视化调试: Jerry:UE4物理模块(一)---概述与可视化调试​zhuanlan.zhihu.com 这里调试只谈到了碰撞盒(后续还会有 ...

  4. Asp.Net Core子应用由于配置中重复添加模块会引起IIS错误500.19

    ASP.NET Core已经从IIS中解耦,可以作为自宿主程序运行,不再依赖IIS. 但我们还是需要强大的IIS作为前置服务器,IIS利用httpPlatformHandler模块来对后台的一些web ...

  5. Apache不重新编译,利用apxs工具给Apache添加模块,如cgi模块

    想实践下Apache是如何运行cgi程序的,却发现先前编译安装Apache的时候,没有安装Apache的cgi模块. 附:CentOS6.x编译安装LAMP(2):编译安装 Apache2.2.25 ...

  6. apache2添加模块和添加站点

    apache2添加模块和添加站点 linux下的apache2的目录和windows上的区别还是很大的,但是用起来却更方便了,详解请看另一篇文章http://www.cnblogs.com/wancy ...

  7. nginx添加模块 (非覆盖安装)

    nginx添加模块(非覆盖安装) 原已经安装好的nginx,现在需要添加一个未被编译安装的模块: 查看原来编译时都带了哪些参数# /usr/local/nginx/sbin/nginx -V ngin ...

  8. Linux下Nginx的安装、升级及动态添加模块

    系统基于ubuntu server 14.04.4 amd64 安装 第一步 下载并解压Nginx压缩包 从Nginx官网下载Nginx,或者在Linux上执行wget http://nginx.or ...

  9. yii2 添加模块过程

    本文以Yii2基本应用程序模板为例,介绍下向该框架下加入新模块的过程: 1. 新建模块相关目录与文件 step 1: 新建目录结构   首先在根目录下新建modules目录,然后在该目录下面添加模块目 ...

随机推荐

  1. Windows Runtime (RT)

    学了sl for wp 开发了1年都没入门,只能说自己的学习欲望太低了. 今天偶然才发现wrt 跟 .net 是2个东西... orz. 得抛弃 sl ,wrt才是未来的主流吧... 这篇文章不错 h ...

  2. Robot Framework(二)访问数据库

    1.在Test suit中添加Library 直接输入库名,点击确定即可 DatabaseLibrary BuiltIn 2.在用例中,连接数据库,并执行sql Connect To Database ...

  3. JSP和JSTL视图解析器

    使用JSTL users.jsp <%@ page language="java" contentType="text/html; charset=UTF-8&qu ...

  4. 如何在Python中快速画图——使用Jupyter notebook的魔法函数(magic function)matplotlib inline

    如何在Python中快速画图--使用Jupyter notebook的魔法函数(magic function)matplotlib inline 先展示一段相关的代码: #we test the ac ...

  5. 代码调试console对象的花式玩法

    转自阮一峰http://www.ruanyifeng.com/home.html console.log(),console.info(),console.debug() console.log方法用 ...

  6. uploadify 上传文件插件

    今天在项目中要用到文件上传功能时,想借助Jquery方式来实现,于是想到用uploadify插件来实现.不经意间在网上看到了一遍关于这个插件的用法,写的很好.在这里就分享给大家,希望对大家有帮助.以下 ...

  7. AngularJs 初级入门 学习笔记

    刚学angular, 做一些笔记方便自己翻看. ng-app: 填写模块的名称 ng-init: 初始化数据(一般通过控制器初始化) ng-model: 填写数据模型 ng-bind: 绑定数据模型, ...

  8. mybatis在spring(Controller) 中的事务配置问题

    这两天一直在折腾一个小工具,非常简单的移动端webapp. 用的是jquery mobile + ssm. 写的差不多的时候,想到解决事务问题,本来以为非常简单,只要在配置文件中加上相应的mybati ...

  9. Delphi Button组件

  10. 解决GitHub添加sshkey仍然无法访问clone远程仓库的问题

    1 ssh -v git@github.com 通过这个命令打印调试信息 ebug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS rece ...