Hey all!
Since 5.3, UBT crashes when compiling plugins in standalone mode (i.e. not part of a project).
Here’s the build command used to repro:
dotnet "<PathToEngine>\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" UnrealEditor Win64 Development -plugin=<PathToPlugin>\<PluginName>.uplugin
Here’s repro’s log:
Using user-specified engine root: z:\Unreal\UE_5.3
Using bundled DotNet SDK version: 6.0.302
Running UnrealBuildTool: dotnet "..\..\Engine\Binaries\DotNET\UnrealBuildTool\UnrealBuildTool.dll" UnrealEditor Win64 Development -plugin=C:\PluginDevelopmentTemp\Plugins\ExpressiveText\ExpressiveText.uplugin
Log file: C:\Users\User\AppData\Local\UnrealBuildTool\Log.txt
Creating makefile for UnrealEditor (UnrealBuildTool assembly is newer)
Total execution time: 36.41 seconds
Unhandled exception: System.ArgumentNullException: Value cannot be null. (Parameter 'element')
at System.Attribute.GetCustomAttributes(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T](MemberInfo element)
at UnrealBuildTool.ModuleRules.IsValidForTarget(Type ModuleType, ReadOnlyTargetRules TargetRules, String& InvalidReason) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Configuration\ModuleRules.cs:line 1623
at UnrealBuildTool.UEBuildTarget.AddAllValidModulesToTarget(ILogger Logger) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 3891
at UnrealBuildTool.UEBuildTarget.PreBuildSetup(ILogger Logger) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 3354
at UnrealBuildTool.UEBuildTarget.Create(TargetDescriptor Descriptor, Boolean bSkipRulesCompile, Boolean bForceRulesCompile, Boolean bUsePrecompiled, UnrealIntermediateEnvironment IntermediateEnvironment, ILogger Logger) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 1366
at UnrealBuildTool.UEBuildTarget.Create(TargetDescriptor Descriptor, BuildConfiguration BuildConfiguration, ILogger Logger) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Configuration\UEBuildTarget.cs:line 1208
at UnrealBuildTool.BuildMode.CreateMakefileAsync(BuildConfiguration BuildConfiguration, TargetDescriptor TargetDescriptor, ISourceFileWorkingSet WorkingSet, ILogger Logger) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 1114
at UnrealBuildTool.BuildMode.BuildAsync(List`1 TargetDescriptors, BuildConfiguration BuildConfiguration, ISourceFileWorkingSet WorkingSet, BuildOptions Options, FileReference WriteOutdatedActionsFile, ILogger Logger, Boolean bSkipPreBuildTargets) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 396
at UnrealBuildTool.BuildMode.ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\Modes\BuildMode.cs:line 252
at UnrealBuildTool.UnrealBuildTool.Main(String[] ArgumentsArray) in Z:\Unreal\UE_5.3\Engine\Source\Programs\UnrealBuildTool\UnrealBuildTool.cs:line 659
Going deep into UBT land, the problem seems to be related to changes to UEBuildTarget.cs:
UnrealBuildTool: Add SupportedTargetTypes attribute, allowing for Mod… · EpicGames/UnrealEngine@22d7100 (github.com)
GetModuleRulesType() is actually returning a null type because it can’t find it on the precompiled UE5Rules assembly - In my case it’s failing for “PoseCorrectives.Build.cs”, not sure if this is something specific to this module (it does go fine for many other engine plugin modules that come before).
I’ve also confirmed that other people are having the same issue. Someone using Plugin Builder has posted about the same issue (on the questions section):
Plugin Builder in Code Plugins - UE Marketplace (unrealengine.com)
It’s important to mention this issue does not reproduce when compiling the plugin as part of a project, or when using the same command on 5.2.
Tagging @Rinn.EG and @Naotsun for visibility
Cheers!