Hi there,
I’m currently working in a small example project to test some ideas I have about some editor code for my main project. One of the things I wanted to focus on was make sure everything I was doing is buildable, and that I had established the right process for maintaining editor code.
I’ve created a separate editor module with my editor specific code in it, and the build.cs for my editor includes UnrealEd, however when I build my project I’m getting a raft of errors relating to it, the only way I can get it to avoid these errors is by simply commenting out my editor module in my project’s target.cs. I would’ve assumed “if(bBuildEditor)” to be false in development builds, but I’m now guessing it’s not? If that, then, is the case, what is the query I should be using to ensure my editor is not included even in development builds of the game, but still in development editor?
Here’s an example of the kind of errors I’m getting for the build:
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Public\EdGraph/EdGraphNodeUtils.h(31): error C2039: 'GetGraph': is not a member of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Classes\EdGraph/EdGraphNode.h(171): note: see declaration of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Public\EdGraph/EdGraphNodeUtils.h(31): error C2039: 'GetSchema': is not a member of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Classes\EdGraph/EdGraphNode.h(171): note: see declaration of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Public\EdGraph/EdGraphNodeUtils.h(31): error C2227: left of '->IsCacheVisualizationOutOfDate' must point to class/struct/union/generic type
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Public\EdGraph/EdGraphNodeUtils.h(54): error C2039: 'GetGraph': is not a member of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Classes\EdGraph/EdGraphNode.h(171): note: see declaration of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Public\EdGraph/EdGraphNodeUtils.h(57): error C2039: 'GetSchema': is not a member of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Classes\EdGraph/EdGraphNode.h(171): note: see declaration of 'UEdGraphNode'
U:\UnrealEngine-4.17.2\Engine\Source\Runtime\Engine\Public\EdGraph/EdGraphNodeUtils.h(57): error C2227: left of '->GetCurrentVisualizationCacheID' must point to class/struct/union/generic type
U:\UnrealEngine-4.17.2\Engine\Source\Editor\BlueprintGraph\Classes\K2Node.h(180): error C3668: 'UK2Node::ReconstructNode': method with override specifier 'override' did not override any base class methods
U:\UnrealEngine-4.17.2\Engine\Source\Editor\BlueprintGraph\Classes\K2Node.h(181): error C3668: 'UK2Node::GetNodeTitleColor': method with override specifier 'override' did not override any base class methods
for context here’s my projects files:
Uproject:
{
"FileVersion": 3,
"EngineAssociation": "{92C5AC8E-4175-8E02-07FE-01BC4C19F361}",
"Category": "",
"Description": "",
"Modules": [
{
"Name": "NoteTest",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine"
]
},
{
"Name": "NoteTestEditor",
"Type": "Editor",
"LoadingPhase": "PostEngineInit"
}
]
}
Project Target.cs
using UnrealBuildTool;
using System.Collections.Generic;
public class NoteTestTarget : TargetRules
{
public NoteTestTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.Add("NoteTest");
if (UEBuildConfiguration.bBuildEditor)
{
ExtraModuleNames.AddRange(new string[]{"NoteTestEditor"});
}
}
}
Editor target.cs
using UnrealBuildTool;
using System.Collections.Generic;
public class NoteTestEditorTarget : TargetRules
{
public NoteTestEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
ExtraModuleNames.AddRange(new string[]{"NoteTest", "NoteTestEditor"});
}
}
Project Build.cs:
using UnrealBuildTool;
public class NoteTest : ModuleRules
{
public NoteTest(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" });
}
}
Editor Build.cs
using UnrealBuildTool;
public class NoteTestEditor : ModuleRules
{
public NoteTestEditor(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] {
"NoteTest",
"Core",
"InputCore"});
PrivateDependencyModuleNames.AddRange(new string[] {
"CoreUObject",
"Engine",
"AssetTools",
"DetailCustomizations",
"EditorStyle",
"PropertyEditor",
"Slate",
"SlateCore",
"MainFrame",
"UnrealEd"});
PublicIncludePaths.AddRange(new string[]{"NoteTestEditor/Public"});
PrivateIncludePaths.AddRange(new string[]{
"NoteTestEditor/Private",
"Editor/DetailCustomizations/Private",
"EditorStyle",
"PropertyEditor"});
}
}
I don’t believe any of the files here are setup in an incorrect manner, though I may be wrong in that assumption.
A related query I have is, what is the distinction between AdditionalDependencies in UProject and adding items in the build.cs? I was previously adding a lot more in AdditionalDependencies, but realised it wasn’t necessary, but I can’t find anything from Google that explains the distinction.