How to merge UE4 C++ projects by adding modules

Let’s say you have 2 code projects, lets call them YourProject and AdvancedWolf and you want to make one, by adding AdvancedWolf code and contents into YourProject.

Here is how to make it using UE4 modules.

Step 0. If your project is not a code project (there is no Source folder), it’s easy to make one by adding an empty C++ class from UE4 menu “Files>Add C++ class”. It will add the class (which you can remove later) and setup all folders and files.

Of course, you will need the Visual Studio to work with code projects, please check the UE4 documentation about setting up VS for UE4. Also note that you may need to update your installed VS to a recent version.

Step 1. Copy AdvancedWolf/Source/AdvancedWolf folder in YourProject/Source. You don’t need to copy the Source/AdvancedWolf.Target.cs and Source/AdvancedWolfEditor.Target.cs files.

(Of course you also need to copy stuff in AdvancedWolf/Content/ in YourProject/Content, but you can also migrate those later, see step 7)

Step 2. Edit both YourProject/Source/YourProject.Target.cs and YourProject/Source/YourProjectEditor.Target.cs and add AdvancedWolf module to ExtraModuleNames:

ExtraModuleNames.AddRange( new string[] { "YourProject", "AdvancedWolf" } );

It adds AdvancedWolf to the list of modules to compile.

Step 3. Edit YourProject/Source/AdvancedWolf/AdvancedWolf.cpp and replace

IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, AdvancedWolf, "AdvancedWolf" );

by

IMPLEMENT_GAME_MODULE( FDefaultGameModuleImpl, AdvancedWolf );

Step 4. Edit YourProject/YourProject.uproject and add AdvancedWolf module to the Modules section, it should look like so:

"Modules": [
{
   "Name": "YourProject",
   "Type": "Runtime",
   "LoadingPhase": "Default",
   "AdditionalDependencies": [
      "Engine"
   ]
   } 
   , { 
      "Name": "AdvancedWolf", 
      "Type": "Runtime", 
      "LoadingPhase": "Default" 
     } 
],

Step 5. Right click on YourProject/YourProject.uproject and choose “Generate VisualStudio project files”

Step 6. Open the project and verify you can see AdvancedWolf folder and public classes in “C++ classes” section of the Content browser.

Step 7. If you migrate the real AdvancedWolf: You can now copy or migrate the Content from the AdvancedWolf project to your project. You need to copy both InuGamesWolfAdv and PolyArtWolf folders. If you ran the install script in the AdvancedWolf project you don’t need to run it again in your project, just copy the PolyArtWolf folder. (Install script will add curves, notify events and virtual bones to play art wolf, you need to run it only once)

Step 8. Optional, if you don’t have the advanced wolf: Buy AdvancedWolf

Leave a Reply

Your email address will not be published.