I’m following a video tutorial for creating editor plugins, since I’m on a Mac I’m using Xcode, for now I’ve called the plugin ‘BlockPlugin’ and the project ‘BlockProject’.
I’ve created a new project (C++ basic template), after creating the project I can build the project in Xcode and I get a message in the Unreal Editor that a hot reload has taken place.
Following along with the tutorial I’ve created the following files in my project folder:
Plugins/BlockPlugin/BlockPlugin.uplugin
{
"FileVersion": 3,
"FriendlyName":"Block Plugin",
"Version": 1,
"VersionName": "1.0",
"EngineVersion":1579795,
"Description": "This describes the plugin",
"Category": "Smeis.Plugin",
"CreatedBy": "My Name",
"CreatedByUrl": "URL",
"Modules": [
{
"Name": "BlockPlugin",
"Type": "Editor"
}
]
}
Plugins/BlockPlugin/Source/BlockPlugin/BlockPlugin.Build.cs
using UnrealBuildTool;
public class BlockPlugin : ModuleRules
{
public BlockPlugin(TargetInfo target)
{
PrivateIncludePaths.AddRange(new string[] { "BlockPlugin/Private" });
PrivateDependencyModuleNames.AddRange(
new[]
{
"Engine",
"UnrealEd",
"InputCore",
"Core",
"Slate",
"SlateCore",
"EditorStyle",
"CoreUObject"
});
}
}
And in Plugins/BlockPlugin/Source/BlockPlugin/Private I’ve created the following files:
BlockPluginPch.h
#include "ModuleManager.h"
Module.h
#pragma once
DECLARE_LOG_CATEGORY_EXTERN(ModuleLog, Log, All);
class Module : public IModuleInterface
{
public:
Module();
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};
Module.cpp
#include "BlockPluginPch.h"
#include "Module.h"
IMPLEMENT_MODULE(Module, BlockPlugin);
DEFINE_LOG_CATEGORY(ModuleLog);
Module::Module()
{
}
void Module::StartupModule()
{
UE_LOG(ModuleLog, Warning, TEXT("Hello from BlockPlugin!"));
}
void Module::ShutdownModule()
{
}
After creating the files I have Unreal Editor refresh the Xcode project. However, when I try to build the project it fails. I have 4 targets in Xcode. The targets BlockProject_Index and BlockProject_Build work fine though I’m not really sure yet what they’re for. Building the BlockProject target fails (I’m assuming that this is the one I need to build to reload the project in the editor).
The build script RocketBuild.sh fails complaining that it can’t find Plugins/BlockPlugin/Source/BlockPlugin/Private/Module.cpp.ex.
Could someone please tell me what a cpp.ex file is and what I’ve done wrong to get this error?