Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

What is the proper method for extending the Editor Engine?

Hi there

I have successfully extended the editor engine to our own version which compiles and works fine in the editor.

But I am having issues getting it to compile for the standalone build (development or debug).

Whats the intended work flow for extending the editor engine (and editor classes in general) for standalone builds. I imagine the idea is to not include them, but how do I stop my class from being automatically picked up in that case?

I tried to use the WITH_EDITOR define, but it seems I have to keep some part of the class definition there and that requires knowing what UUnrealEdEngine is.

Here is the class definition:

 class UOurEditorEngine : public UUnrealEdEngine

I also have the "UnrealEd" module in my PublicDependencyModuleNames

Has anyone succesfully include an extension to the editor engine and got the non editor build compiling?

Product Version: Not Selected
more ▼

asked May 09 '14 at 03:06 AM in C++ Programming

avatar image

496 18 27 142

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You're going to want to make a new module to build your editor specific code, so that it's separate from your game code. Unfortunately we don't seem to have an example/sample which does this, however I'll try and walk you through it as best I can.

If you go to the Source folder for your project, you'll notice you have two .Target.cs files; in my case I'm going to pretend your project is called "MyCodeProject" (replace as appropriate), so you'd see:

  • MyCodeProject.Target.cs

  • MyCodeProjectEditor.Target.cs

If you open up these files, you'll notice that they both output a single module from SetupBinaries, what we're going to do is add an extra module called "MyCodeProjectEditor" to contain your editor code.

Open MyCodeProject.Target.cs and in SetupBinaries add the following:

 if (UEBuildConfiguration.bBuildEditor)

Open MyCodeProjectEditor.Target.cs and in SetupBinaries add the following:


Now, inside your Source folder, create a new folder called "MyCodeProjectEditor", and copy the following files from the "MyCodeProject" folder, into "MyCodeProjectEditor" folder:

  • MyCodeProject.Build.cs

  • MyCodeProject.h

  • MyCodeProject.cpp

Rename these files in the "MyCodeProjectEditor" folder so you see:

  • MyCodeProjectEditor.Build.cs

  • MyCodeProjectEditor.h

  • MyCodeProjectEditor.cpp

Open MyCodeProjectEditor.Build.cs and rename the class from "MyCodeProject" to "MyCodeProjectEditor".

Open MyCodeProjectEditor.cpp, and fix the include name, and then change the macro which implements the module to be:

 IMPLEMENT_GAME_MODULE( FDefaultGameModuleImpl, MyCodeProjectEditor );

Finally you need to update your .uproject file so that it knows about your new module, so open that up in some form of competent text editor (eg, Notepad++), and adjust the "Modules" section so that it contains your new editor module; when you're finished, it would look something like this:

 "Modules": [
         "Name": "MyCodeProject",
         "Type": "Runtime",
         "LoadingPhase": "Default"
         "Name": "MyCodeProjectEditor",
         "Type": "Editor",
         "LoadingPhase": "Default"

If you re-generate your projects and build, you should hopefully now have a separate editor module. You'll be able to use this module to contain your editor specific code (move the editor dependencies into the MyCodeProjectEditor.Build.cs file, and move the editor specific code into that module folder).

You'll probably also want to add "MyCodeProject" to the PublicDependencyModuleNames in your MyCodeProjectEditor.Build.cs file, as this will allow your editor module access to your game code.

more ▼

answered May 09 '14 at 09:50 AM

avatar image

Jamie Dale STAFF
7.4k 176 66 304

avatar image Ben.Driehuis May 12 '14 at 01:35 AM

Thanks for that Jamie, I will get that done today and let you know if I run into any issues.

avatar image Ben.Driehuis May 12 '14 at 08:35 AM

Hi Jamie,

So I had a quick go at this doing but whilst I can compile non editor, the editor code fails.

It seems to be failing to link in the my normal games module:

Module.MyCodeProjectEditor.cpp.obj : error LNK2019: unresolved external symbol "public: static class UClass __cdecl AMyCodeProjectActor::GetPrivateStaticClass(wchar_t const )"

I added MyCodeProject to the PublicDependencyModuleNames in the MyCodeProjectEditor.Build.cs

I am currently still on an early version of UE4 so maybe there was something that changed also causing this. We are in the process of moving to the latest github version.

It does seem to be linking the MyCodeProject.dll first and that succeeds.

avatar image Jamie Dale STAFF May 12 '14 at 09:25 AM

Okay, I'll have a go at reproducing this locally.

Could you first try deleting/renaming the Intermediate folder for your project (you'll need to re-generate your Visual Studio project files again after doing this), just to rule out any stale build files that might still be lurking around from when these two modules were combined.

avatar image Jamie Dale STAFF May 12 '14 at 10:58 AM

Hi Ben, sorry for the delay, I had some issues getting UnrealVersionSelector working for my build.

I've managed to reproduce this locally, and I suspect you may have the same issue.

To link to a class from another module, it needs to have been exported via the API macro for that module; our new class wizard doesn't add this, so you'll need to add it to any public classes yourself. It will look something like this:

 class MYCODEPROJECT_API AMyActor : public AActor

All in all, this has been a very useful question as it's highlighted some flaws with our processes. I'm scheduled to make some improvements to the new class wizard, so I'll make a note to ensure that the API macro is added to public classes by default; I've also raised a bug about making the process of adding a new module a lot easier.

I've also found that if you're not using the Public/Private folder layout, then you can't include your headers into another module (I assume you're already using this layout since you only had linker errors). This is an issue that the core team is already looking at.

avatar image Ben.Driehuis May 12 '14 at 11:58 AM

Adding the API made it compile here too, thank you very much!

avatar image rhm Jun 15 '14 at 06:51 PM

https://docs.unrealengine.com/latest/INT/Programming/Modules/Gameplay/index.html badly needs updating with the information on this page.

avatar image Shadowriver Jul 15 '15 at 04:25 PM

But editor coding is quite diffrent from gameplay coding which module making for that is described in there. Editor extending needs separate documentation imo

avatar image Brechtos Jul 15 '15 at 04:18 PM

Great Answer Jamie!! As rhm suggested. Updating the documentation page might need an update regarding this matter.

avatar image Ryan Darcey Dec 22 '16 at 03:03 AM

Not sure why, but after adding this to my uproject file:

      "Name": "MyCodeProjectEditor",
      "Type": "Editor",
      "LoadingPhase": "Default"

I get this error when trying to generate new project files:

alt text

Can't tell what file needs to be unlocked :/ Any ideas?

untitled.png (2.8 kB)
avatar image Matthew J Jan 30 '17 at 08:25 PM

Hello rcdarcey. I just came across this post so you may of already fixed this issue. If you haven't, you should be able to fix that by making sure that your .uproject file is not set to Read-Only

avatar image Leonardo Rocha Mar 16 '17 at 04:36 PM

Hey rcdarcey, delete your unreal project intermediate folder and intermediate plugin folder (if exist), next step is re-generate project files of your unreal project.

avatar image Arshia001 Jul 27 '17 at 07:35 AM

So, 3 years later, has the option to automatically add new modules been implemented? Not that it's particularly difficult to do by hand, but elegant solutions are always better!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question