Modules are the building blocks of Unreal Engine (UE). The engine is implemented as a large collection of modules, and games supply their own modules to augment them. Each module encapsulates a set of functionality, and can provide a public interface and compile environment (with macros, include paths, and so on) for use by other modules.
Modules are declared through C# source files with a .build.cs
extension, and are stored under your project's Source
directory. The C++ source code belonging to a module is stored next to to the .build.cs
file, or in subdirectories of it. Each .build.cs
file declares a class deriving from the ModuleRules
base class, and sets properties controlling how it should be built from its constructor. These .build.cs
files are compiled by Unreal Build Tool (UBT) and constructed to determine the overall compile environment.
The typical structure for a .build.cs
file is as follows.
using UnrealBuildTool;
using System.Collections.Generic;
public class MyModule : ModuleRules
{
public MyModule(ReadOnlyTargetRules Target) : base(Target)
{
// Properties and settings go here
}
}
Title: Build Configuration Properties Page Crumbs: Description: This is a procedurally generated markdown page. Version: 5.4
Read-Only Properties
-
IsPlugin (Boolean): True if a Plugin contains this module
-
Logger (ILogger): Accessor for the target logger
-
HasPackageOverride (Boolean): Returns true if there has been an override type specified on this module
-
AutoSdkDirectory (String): The AutoSDK directory for the active host platform
-
EngineDirectory (String): The current engine directory
-
PluginDirectory (String): Property for the directory containing this plugin. Useful for adding paths to third party dependencies.
-
ModuleDirectory (String): Property for the directory containing this module. Useful for adding paths to third party dependencies.
-
TestsDirectory (String): Returns module's low level tests directory "Tests".
-
IsVcPackageSupported (Boolean): Returns if VcPkg is supported for the build configuration.
Read/Write Properties
$ Type (ModuleType): Type of module
$ BinariesSubFolder (String): Subfolder of Binaries/PLATFORM folder to put this module in when building DLLs. This should only be used by modules that are found via searching like the TargetPlatform or ShaderFormat modules. If FindModules is not used to track them down, the modules will not be found.
$ PrivatePCHHeaderFile (String): Explicit private PCH for this module. Implies that this module will not use a shared PCH.
$ SharedPCHHeaderFile (String): Header file name for a shared PCH provided by this module. Must be a valid relative path to a public C++ header file. This should only be set for header files that are included by a significant number of other C++ modules.
$ ShortName (String): Specifies an alternate name for intermediate directories and files for intermediates of this module. Useful when hitting path length limitations.
$ bTreatAsEngineModule (Boolean): Whether this module should be treated as an engine module (eg. using engine definitions, PCHs, compiled with optimizations enabled in DebugGame configurations, etc...). Initialized to a default based on the rules assembly it was created from.
$ bUseRTTI (Boolean): Use run time type information
$ bCodeCoverage (Boolean): Enable code coverage compilation/linking support.
$ MinCpuArchX64 (Nullable
$ bEnableBufferSecurityChecks (Boolean): Enable buffer security checks. This should usually be enabled as it prevents severe security risks.
$ bEnableExceptions (Boolean): Enable exception handling
$ bEnableObjCExceptions (Boolean): Enable objective C exception handling
$ bEnableObjCAutomaticReferenceCounting (Boolean): Enable objective C automatic reference counting (ARC) If you set this to true you should not use shared PCHs for this module. The engine won't be extensively using ARC in the short term Not doing this will result in a compile errors because shared PCHs were compiled with different flags than consumer
$ bWarningsAsErrors (Boolean): Whether to enable all warnings as errors. UE enables most warnings as errors already, but disables a few (such as deprecation warnings).
$ bEnableUndefinedIdentifierWarnings (Boolean): Enable warnings for using undefined identifiers in #if expressions
$ bDisableStaticAnalysis (Boolean): Disable all static analysis - clang, msvc, pvs-studio.
$ bStaticAnalyzerExtensions (Boolean): Enable additional analyzer extension warnings using the EspXEngine plugin. This is only supported for MSVC. See https://learn.microsoft.com/en-us/cpp/code-quality/using-the-cpp-core-guidelines-checkers This will add a large number of warnings by default. It's recommended to use StaticAnalyzerRulesets if this is enabled.
$ StaticAnalyzerRulesets (HashSet
$ StaticAnalyzerCheckers (HashSet
$ StaticAnalyzerDisabledCheckers (HashSet
$ StaticAnalyzerAdditionalCheckers (HashSet
$ bMergeUnityFiles (Boolean): Whether to merge module and generated unity files for faster compilation.
$ MinSourceFilesForUnityBuildOverride (Int32): The number of source files in this module before unity build will be activated for that module. If set to anything besides -1, will override the default setting which is controlled by MinGameModuleSourceFilesForUnityBuild
$ MinFilesUsingPrecompiledHeaderOverride (Int32): Overrides BuildConfiguration.MinFilesUsingPrecompiledHeader if non-zero.
$ NumIncludedBytesPerUnityCPPOverride (Int32): Overrides Target.NumIncludedBytesPerUnityCPP if non-zero.
$ bBuildLocallyWithSNDBS (Boolean): Module uses a #import so must be built locally when compiling with SN-DBS
$ bEnableNonInlinedGenCppWarnings (Boolean): Enable warnings for when there are .gen.cpp files that could be inlined in a matching handwritten cpp file
$ IsRedistributableOverride (Nullable
$ bLegalToDistributeObjectCode (Boolean): Whether the output from this module can be publicly distributed, even if it has code/ dependencies on modules that are not (i.e. CarefullyRedist, NotForLicensees, NoRedist). This should be used when you plan to release binaries but not source.
$ AllowedRestrictedFolders (List
$ AliasRestrictedFolders (Dictionary
$ IWYUSupport (IWYUSupport): Allows "include what you use" to modify the source code when run. bEnforceIWYU must be true for this variable to matter.
$ bAddDefaultIncludePaths (Boolean): Whether to add all the default include paths to the module (eg. the Source/Classes folder, subfolders under Source/Public).
$ bIgnoreUnresolvedSymbols (Boolean): Whether to ignore dangling (i.e. unresolved external) symbols in modules
$ bPrecompile (Boolean): Whether this module should be precompiled. Defaults to the bPrecompile flag from the target. Clear this flag to prevent a module being precompiled.
$ bUsePrecompiled (Boolean): Whether this module should use precompiled data. Always true for modules created from installed assemblies.
$ bAllowConfidentialPlatformDefines (Boolean): Whether this module can use PLATFORM_XXXX style defines, where XXXX is a confidential platform name. This is used to ensure engine or other shared code does not reveal confidential information inside an #if PLATFORM_XXXX block. Licensee game code may want to allow for them, however.
$ bAllowAutoRTFMInstrumentation (Boolean): Enables AutoRTFM instrumentation to this module only when AutoRTFMCompiler is enabled
$ PublicIncludePathModuleNames (List
$ PublicDependencyModuleNames (List
$ PrivateIncludePathModuleNames (List
$ PrivateDependencyModuleNames (List
$ CircularlyReferencedDependentModules (List
$ PublicSystemIncludePaths (List
$ PublicIncludePaths (List
$ InternalncludePaths (List
$ PrivateIncludePaths (List
$ PublicSystemLibraryPaths (List
$ PrivateRuntimeLibraryPaths (List
$ PublicRuntimeLibraryPaths (List
$ PublicAdditionalLibraries (List
$ DependenciesToSkipPerArchitecture (Dictionary
$ PublicPreBuildLibraries (List
$ PublicSystemLibraries (List
$ PublicFrameworks (List
$ PublicWeakFrameworks (List
$ PublicAdditionalFrameworks (List
$ AdditionalBundleResources (List
$ TypeLibraries (List
$ PublicDelayLoadDLLs (List
$ PrivateDefinitions (List
$ PublicDefinitions (List
$ DynamicallyLoadedModuleNames (List
$ RuntimeDependencies (RuntimeDependencyList): List of files which this module depends on at runtime. These files will be staged along with the target.
$ AdditionalPropertiesForReceipt (ReceiptPropertyList): List of additional properties to be added to the build receipt
$ PrecompileForTargets (PrecompileTargetsType): Which targets this module should be precompiled for
$ ExternalDependencies (List
$ SubclassRules (List
$ bRequiresImplementModule (Nullable
$ VersePath (String): If this module has associated Verse code, this is the Verse root path of it
$ VerseScope (VerseScope): Visibility of Verse code in this module's Source/Verse folder
$ bValidateCircularDependencies (Boolean): Whether circular dependencies will be validated against the allow list Circular module dependencies result in slower builds. Disabling this option is strongly discouraged. This option is ignored for Engine modules which will always be validated against the allow list.
$ CppStandard (Nullable
$ CStandard (Nullable
$ GenerateHeaderFuncs (List
$ ModuleSymbolVisibility (SymbolVisibility): Control visibility of symbols
$ Name (String): Name of this module
$ OverridePackageType (PackageOverrideType): Overridden type of module that will set different package flags. Cannot be used for modules that are a part of a plugin because that is set in the .uplugin
file already.
$ OptimizeCode (CodeOptimization): When this module's code should be optimized.
$ OptimizationLevel (OptimizationMode): Allows fine tuning optimization level for speed and\or code size. This requires a private PCH (or NoPCHs, which is not recommended)
$ PCHUsage (PCHUsageMode): Precompiled header usage for this module
$ DefaultBuildSettings (BuildSettingsVersion): Which engine version's build settings to use by default.
$ IncludeOrderVersion (EngineIncludeOrderVersion): What version of include order to use when compiling this module. Can be overridden via -ForceIncludeOrder on the command line or in a module's rules.
$ bUseAVX (Boolean): Obsolete: Direct the compiler to generate AVX instructions wherever SSE or AVX intrinsics are used, on the platforms that support it. Note that by enabling this you are changing the minspec for the PC platform, and the resultant executable will crash on machines without AVX support.
$ DeterministicWarningLevel (WarningLevel): How to treat deterministic warnings (experimental).
$ ShadowVariableWarningLevel (WarningLevel): How to treat shadow variable warnings
$ UnsafeTypeCastWarningLevel (WarningLevel): How to treat unsafe implicit type cast warnings (e.g., double->float or int64->int32)
$ ModuleIncludePathWarningLevel (WarningLevel): How to treat general module include path validation messages
$ ModuleIncludePrivateWarningLevel (WarningLevel): How to treat private module include path validation messages, where a module is adding an include path that exposes private headers
$ ModuleIncludeSubdirectoryWarningLevel (WarningLevel): How to treat unnecessary module sub-directory include path validation messages
$ bUseUnity (Boolean): If unity builds are enabled this can be used to override if this specific module will build using Unity. This is set using the per module configurations in BuildConfiguration.
$ bEnforceIWYU (Boolean): Enforce "include what you use" rules when PCHUsage is set to ExplicitOrSharedPCH; warns when monolithic headers (Engine.h, UnrealEd.h, etc...) are used, and checks that source files include their matching header first.
$ bLegacyPublicIncludePaths (Boolean): Whether this module qualifies included headers from other modules relative to the root of their 'Public' folder. This reduces the number of search paths that have to be passed to the compiler, improving performance and reducing the length of the compiler command line.
$ bLegacyParentIncludePaths (Boolean): Whether this module qualifies included headers from other modules relative to the parent directory. This reduces the number of search paths that have to be passed to the compiler, improving performance and reducing the length of the compiler command line.