Creating a new editor module

The following recipes all interact with editor mode-specific code and engine modules. As a result, it is considered good practice to create a new module that will only be loaded when the engine is running in editor mode so that we can place all our editor-only code inside it.

How to do it…

  1. Open your project's .uproject file in a text editor such as Notepad or Notepad++.
  2. Add the bolded section of the following to the file:
    {
      "FileVersion": 3,
      "EngineAssociation": "4.11",
      "Category": "",
      "Description": "",
      "Modules": [
        {
          "Name": "UE4Cookbook",
          "Type": "Runtime",
          "LoadingPhase": "Default",
          "AdditionalDependencies": [
            "Engine",
            "CoreUObject"
          ]
        },
        {
          "Name": "UE4CookbookEditor",
          "Type": "Editor",
     "LoadingPhase": "PostEngineInit", ...

Get Unreal Engine 4 Scripting with C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.