ue4打包多模块

本文详细介绍了如何在UnrealEngine中使用IMPLEMENT_MODULE宏来管理模块加载,包括模块的启动和关闭函数,以及如何在build.cs文件中配置模块依赖。同时,还展示了如何在项目中整合插件和模块,以及打包过程中的注意事项。

首先,每个模块,包含插件内的模块在内,都要用IMPLEMENT_MODULE(类名, 模块名)的方式,模块名就是带.build.cs的第一个单词。

build.cs里就说了这个模块该怎么用,用c#编写。

打包中要考虑到target.cs,将工程中相应的模块打包进去
uproject就要连插件和模块一起写进去

比如
在这里插入图片描述

这里,CoreOne和CoreTwo是工程里的多模块,myplugin和otherM是插件里的多模块。废话不多说,上代码

以工程中的一个模块CoreOne为例

coreOne.h

#pragma once

#include “CoreMinimal.h”
#include “Modules/ModuleManager.h”

class FCoreOneModule : public FDefaultGameModuleImpl
{
public:

/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;

};

coreone.cpp

#include “CoreOne.h”
#include “Modules/ModuleManager.h”

#define LOCTEXT_NAMESPACE “CoreOne”

void FCoreOneModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}

void FCoreOneModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}

#undef LOCTEXT_NAMESPACE

IMPLEMENT_MODULE(FCoreOneModule, CoreOne);

coreone.build.cs
// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;

public class CoreOne : ModuleRules
{
public CoreOne(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

	PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject",
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值