Hi,
I’m trying to create a editor module that runs at initialization.
I’ve tried following a couple tutorials like:
- http://cairansteverink.nl/cairansteverink/blog/creating-an-editor-module-in-unreal-engine-4/
- UE4 Code Modules — kantan
- https://sandordaemen.nl/blog/creating-an-editor-module-in-unreal-engine-4/
and keep running into the same issue:
Unable to delete C:\Users\anema\Documents\Unreal Projects\Testing\Binaries\Win64\UE4Editor-Testing.dll (Unable to delete ‘C:\Users\anema\Documents\Unreal Projects\Testing\Binaries\Win64\UE4Editor-Testing.dll’: Access to the path ‘C:\Users\anema\Documents\Unreal Projects\Testing\Binaries\Win64\UE4Editor-Testing.dll’ is denied.) Testing C:\Users\anema\Documents\Unreal Projects\Testing\Intermediate\ProjectFiles\UnrealBuildTool 1
Could not find definition for module ‘TestingEditor’, (referenced via TestingEditor.Target.cs) Testing C:\Users\anema\Documents\Unreal Projects\Testing\Intermediate\ProjectFiles\UnrealBuildTool 1
The command “chcp 65001 >NUL && “C:\Program Files\Epic Games\UE_4.25\Engine\Build\BatchFiles\Rebuild.bat” TestingEditor Win64 Development -Project=“C:\Users\anema\Documents\Unreal Projects\Testing\Testing.uproject” -WaitMutex -FromMsBuild” exited with code -1.
I believe it might be an issue in the definition of my [ModuleName].h file, but i cant figure out the exact reason.
This is my [ModuleName].Build.cs file
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
public class TestingEditor : ModuleRules
{
public TestingEditor(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Testing" });
PrivateDependencyModuleNames.AddRange(new string[] { });
PublicIncludePaths.AddRange(new string[] { "TestingEditor/Public" });
PrivateIncludePaths.AddRange(new string[] { "TestingEditor/Private" });
// Uncomment if you are using Slate UI
// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });
// Uncomment if you are using online features
// PrivateDependencyModuleNames.Add("OnlineSubsystem");
// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
}
}
This is my [ModuleName].h file, place in /Source/[ModuleName]/Public/
#pragma once
#include "CoreMinimal.h"
#include "Modules/ModuleManager.h"
#include "Modules/ModuleInterface.h"
class FTestingEditorModule : public IModuleInterface
{
public:
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
and finally my [ModuleName].cpp file place in the private folder
#include "..\Public\TestingEditor.h"
#include "Modules/ModuleManager.h"
IMPLEMENT_GAME_MODULE(FTestingEditorModule, TestingEditor);
#define LOCTEXT_NAMESPACE "FTestingEditorModule"
void FTestingEditorModule::StartupModule()
{
UE_LOG(LogTemp, Warning, TEXT("StartupModule() called"));
}
void FTestingEditorModule::ShutdownModule()
{
UE_LOG(LogTemp, Warning, TEXT("ShutdownModule() called"));
}
#undef LOCTEXT_NAMESPACE
Added the module description in the .uproject file
{
"Name": "TestingEditor",
"Type": "Editor",
"LoadingPhase": "PreDefault"
}
and below is my editor.target.cs file
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class TestingEditorTarget : TargetRules
{
public TestingEditorTarget( TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange( new string[] { "Testing", "TestingEditor" } );
}
}
this might be the cause of the error as VS shows the function
IMPLEMENT_GAME_MODULE(F[ModuleName]Module, [ModuleName]);
as function definition for the above function is not found