Hello Folk!
So am having a weird issue with my source code. I created an editor module:
NightRaidEditor
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleInterface.h"
DECLARE_LOG_CATEGORY_EXTERN(NightRaidEditor, All, All)
class FNightRaidEditor: public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
And it’s friend the cpp:
#include "NightRaidEditor.h"
#include "Modules/ModuleManager.h"
#include "Modules/ModuleInterface.h"
IMPLEMENT_GAME_MODULE(FNightRaidEditor, NightRaidEditor);
DEFINE_LOG_CATEGORY(NightRaidEditor)
#define LOCTEXT_NAMESPACE "NightRaidEditor"
void FNightRaidEditor::StartupModule()
{
UE_LOG(NightRaidEditor, Warning, TEXT("NightRaidEditor: Log Started"));
}
void FNightRaidEditor::ShutdownModule()
{
UE_LOG(NightRaidEditor, Warning, TEXT("NightRaidEditor: Log Ended"));
}
#undef LOCTEXT_NAMESPACE
Here is the build file:
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
public class NightRaidEditor : ModuleRules
{
public NightRaidEditor(ReadOnlyTargetRules Target) : base(Target)
{
if(Target.Type != TargetType.Editor)
{
throw new BuildException("Unable to instantiate NightRaidEditor module for non-editor targets.");
}
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bAllowConfidentialPlatformDefines = true;
PublicIncludePaths.AddRange(
new string[]
{
"NightRaidEditor/Public"
});
PrivateIncludePaths.AddRange(
new string[]
{
"NightRaidEditor/Private",
});
PublicDependencyModuleNames.AddRange(
new string[]
{
"NightRaid","Core", "CoreUObject", "Engine"
});
PrivateDependencyModuleNames.AddRange(
new string[]
{
"Slate", "SlateCore", "AssetTools", "EditorStyle", "Blutility", "UMGEditor", "Json", "JsonUtilities","UnrealEd"
});
PrivateIncludePathModuleNames.AddRange(
new string[]
{
});
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
});
}
}
And it’s properly configured in the uproject file:
"Modules": [
{
"Name": "NightRaid",
"Type": "Runtime",
"LoadingPhase": "Default",
"AdditionalDependencies": [
"Engine"
]
},
{
"Name": "NightRaidEditor",
"Type": "Editor",
"LoadingPhase": "Default"
}
],
Same with the target
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class NightRaidEditorTarget : TargetRules
{
public NightRaidEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange( new string[] { "NightRaid" } );
ExtraModuleNames.AddRange(new string[] { "NightRaidEditor" });
}
}
So I went ahead, compiled, and all good. Now I want to add a hook for our version control system, so I created a class that inherits from UUnrealEdEngine
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Editor/UnrealEdEngine.h"
/**
*
*/
class NIGHTRAIDEDITOR_API UNightRaidEdEngine : public UUnrealEdEngine
{
public:
virtual void Init(IEngineLoop* InEngineLoop) override;
UNightRaidEdEngine();
~UNightRaidEdEngine();
};
implemented the init function.
But here’s when things are happening that am not getting. If I add this line to my DefaultEngine.ini
[/Script/Engine.Engine]
UnrealEdEngine=/Script/NightRaidEditor.NightRaidEdEngine
Editor won’t open and will show me this:
[2022.03.15-06.56.42:934][ 0]LogLinker: Warning: Failed to load '/Script/NightRaidEditor': Can't find file.
[2022.03.15-06.56.42:934][ 0]LogLinker: Warning: Failed to load '/Script/NightRaidEditor': Can't find file.
[2022.03.15-06.56.42:934][ 0]LogUObjectGlobals: Warning: Failed to find object 'Class /Script/NightRaidEditor.NightRaidEdEngine'
[2022.03.15-06.56.42:934][ 0]LogOutputDevice: Warning:
Script Stack (0 frames):
Fatal error: [File:C:/Github/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp] [Line: 3984]
Failed to load UnrealEd Engine class '/Script/NightRaidEditor.NightRaidEdEngine'.
Any help with this? Anyone has any idea what am I doing wrong?
Thanks in advance!