Hello,
Here is my loooong question post.
I spend a good amount of time and finally could successfully confirmed that Tom Looman’s MOD example works as described with 4.19.2 on Windows 10 64 bit. (I created my own project with 4.19.2 rather than converting his project. So the filenames are slightly different from his)
http://www.tomlooman.com/add-mod-support-to-your-unreal-engine-4-game/
The trick I found is that his tutorial enables the MOD plugin both when I cook the executable and when I cook the MOD plugin. With this process, I confirmed that NewMapMod.uplugin file is cooked in executable’s pak file and the rest of Plugin contents are cooked in plugin’s pak file. (I used “UnrealPak.exe [pakfilename] -List” command to confirm that) And after I put the plugin .pak file next to the executable’s .pak file, I could run the game and load the DLC map. Nice.
Then I looked for if there is a way to include NewMapMod.uplugin in the plugin’s pak file and make the MOD plugin independent from specific executable build. According to engine source, it seems the key is “DLCPakPluginFile” option for the cooker. So I tried to use the option and failed. I like to know how to use the option correctly.
Let me explain my failed attempt in detail below.
First, I disabled the MOD plugin when I cooked the executable then enabled the MOD plugin when I cooked the plugin and check which file is in each pak. In this way, NewMapMod.uplugin isn’t in the executable anymore as expected. But NewMapMod.uplugin is not in plugin pak file either. Loading NewMap.umap from with “open NewMap” command in the game fails. (I guess it’s because UE doesn’t recognize the plugin due to lack of .uplugin file. This implies MOD plugin must be recognized as a valid plugin on Windows)
Then, I looked for the reason why NewMapMod.uplugin isn’t in the plugin’s .pak file. And I found the line 283 of https://github.com/EpicGames/UnrealEngine/blob/8e4560b8c22b309e73ff0ce90377742c3dfe13cc/Engine/Source/Programs/AutomationTool/Scripts/CopyBuildToStagingDirectory.Automation.cs excludes any .uplugin file from the .pak file by default.
And I learned that I can add “-DLCPakPluginFile” as Additional Cooker Options from Project Launcher to forcefully include .uplugin file to the plugin pak. (See https://github.com/EpicGames/UnrealEngine/blob/8e4560b8c22b309e73ff0ce90377742c3dfe13cc/Engine/Source/Programs/AutomationTool/AutomationUtils/ProjectParams.cs) I also add “-CookAll” option just in case.
After cooking the executable and the plugin with those options, I confirmed NewMapMod.uplugin is in the plugin .pak file. So I thought I should be able to load the DLC map finally. But I have no luck… Putting the plugin .pak file next to the executable .pak, then running “open NewMap” command in the game doesn’t load the map. I hope someone can give me some advice.
(Especially I want to know to what extent did I come. Is the pak file properly mounted? Is it working as a plugin already? If so, why loading map fails? How can I effectively debug this .pak loading process?)
The project file I used is here. I included the Launcher profile in the UnrealFrontend directory. I also included Pak file comparison with each different build method in PakFileExaminationResult.