<aside> 🗒️ Part of Ari's Unreal Engine Notes.
</aside>
This presentation covers everything about modules and more.
This presentation covers everything about modules and more.
Create a .Build.cs
file that builds the module.
using UnrealBuildTool;
public class FooBar : ModuleRules
{
public FooBar(ReadOnlyTargetRules Target) : base(Target)
{
PrivateDependencyModuleNames.AddRange(new string[] {"Core"});
}
}
Expose classes to the engine via UCLASS
/UPROPERTY
/UFUNCTION
specifiers.
Optionally use UCLASS(MinimalAPI)
to also expose minimal information to other modules, enough to cast to the class.
Expose functions or classes to code in other modules with FOOBAR_API
(use your module name in all caps instead of FOOBAR) in header files in your module's /Public
folder.
UCLASS(Blueprintable)
class FOOBAR_API AExampleActor: public AActor
{
GENERATED_BODY()
// Rest of the class
};
Call IMPLEMENT_MODULE
after any declarations in [YourModuleName]Module.cpp
.
#include "Modules/ModuleManager.h"
IMPLEMENT_MODULE(FDefaultModuleImpl, FooBar);
Add a module descriptor to your .uproject
or .uplugin
file.
"Modules": [
{
"Name": "FooBar",
"Type": "Runtime",
}
]
Only modules in the dependency chain get compiled.
If another module should depend on your module, add it to that module's .Build.cs
file.
PrivateDependencyModuleNames.AddRange(new string[] {"Core", **"**FooBar**"**});
// or PublicDependencyModuleNames, if FooBar is used in this module's public headers.