Beta Version
Plugin to load Pak Plugin at runtime and activate their GameFeatures.
Was not tested on worlds with WorldPartition enabled.
- Untick
Use IO Store
,Use Zen Store
andShare Material Shader Code
inProject Settings > Project > Packaging
- Tick
Generate No Chunks
inProject Settings > Project > Packaging
To test in the editor, we also need to do the following in the testing project:
- Tick
Allow Cooked Content in the Editor
inProject Settings > Engine > Cooker
- Add the line
s.AllowUnversionedContentInEditor=1
in theConfig\DefaultEngine.ini
file, under the category[/Script/UnrealEd.CookerSettings]
. This should look like this:
[/Script/UnrealEd.CookerSettings]
cook.AllowCookedDataInEditorBuilds=True
s.AllowUnversionedContentInEditor=1
In the content browser, right click on All
or Content
and under Aurora
, select Create a Packaged Project
.
In the content browser, right click on any content folder, or select the items to packaged and right click and under Aurora
, select Create a Content DLC Pak
.
It is currently not possible to Mount a DLC Pak which would have the same Mount Point as a plugin.
If you are exporting the plugin Stage_01
as DLC, make sure to remove it from the Plugins
folder before trying to load the DLC of the same name.
Similarly, make sure the plugin does not end up cooked as part of the Base Game Package.
To work as expected, there are a few settings that need to be adjusted manually (for now at least) on both the packaging project and the playing project.
It is important to note that to package individual plugins, we are leveraging the DLC feature of UE.
This is not made to package individual plugins but we can use it to do so.
Packaging a DLC needs a named Base Game package, which should contain everything that will be common to every plugin.
When a DLC is packaged, everything that was not in this named Base Game package will be packaged.
To make this work for us, the goal is to package the project without the plugin to use this as the base of the DLC, then add the plugin and package the DLC.
Note:
The above describe my current understanding the packaging process in UE, it might not be fully accurate
The packaging project is the project in which the GameFeature plugin will be created and packaged from.
We need to package a base version of the project that does not contain any of the plugin information.
We will then package the plugin as a DLC, which will contain all files not present in the base version of the project.
- Untick
Use IO Store
,Use Zen Store
andShare Material Shader Code
inProject Settings > Project > Packaging
- Tick
Generate No Chunks
inProject Settings > Project > Packaging
To test in the editor, we also need to do the following in the testing project:
- Tick
Allow Cooked Content in the Editor
inProject Settings > Engine > Cooker
- Add the line
s.AllowUnversionedContentInEditor=1
in theConfig\DefaultEngine.ini
file, under the category[/Script/UnrealEd.CookerSettings]
. This should look like this:
[/Script/UnrealEd.CookerSettings]
cook.AllowCookedDataInEditorBuilds=True
s.AllowUnversionedContentInEditor=1
To package the plugin, we need to create two Launch Profiles, one to package the project (that will need to be run first), and one to package the actual plugin.
In the main UE Toolbar (next to he Play button), open the Project Launcher...
under the Platforms
dropdown menu:
- In the
Custom Launch Profiles
, add a newCustom Profile
for the Base Game Packaging and name it appropriately (ex:Base Game
)- In the
Project
section, change theProject
toAny Project
(so it compiles the currently opened UE project) - You can adjust the Build Configuration as required under
Build
(tested with Development only) - Under
Cook
, change the cook toBy the book
- choose your platform (only tested on
Windows
) and Culture, and leave the Maps unticked - Under
Release / DLC / Patching
, tickCreate a release version of the game for distribution
and give a name for the release (like1.0
). This name will be needed below- In
Advanced settings
, make sure that onlyCompress Content
,Save packages without versions
andStore all content in a single file (UnrealPak)
are ticked
- In
- choose your platform (only tested on
- Change
Package
toPackage and store locally
and leave everything unticked - Leave
Archive
unticked andDeploy
toDo not Deploy
- In the
The setup is the same as the Base Game setup apart from the Cook
settings:
- In the
Custom Launch Profiles
, add a newCustom Profile
for the Plugin Packaging and name it appropriately (ex:Stage_01 Plugin
)- In the
Project
section, change theProject
toAny Project
(so it compiles the currently opened UE project) - You can adjust the Build Configuration as required under
Build
- Under
Cook
, change the cook toBy the book
- choose your platform (only tested on
Windows
) and Culture, and leave the Maps unticked - Under
Release / DLC / Patching
:- make sure
Create a release version of the game for distribution
is unticked, - make sure
Name of the new release to create
has no name - fill
Release version this is based on
with the name used for the release of the Base Game in the Base Game launch profile (like1.0
) - tick
Build DLC
, and underName of the DLC to build
, write the Plugin Name (ex:Stage_01
) (This does not have to be the same, but some files were be missed if not matching) - make sure
Include Engine Content
is unticked. We want to use the Engine content from the project itself, but we will need to make sure it is packaged. - In
Advanced settings
, make sure that onlyCompress Content
,Save packages without versions
andStore all content in a single file (UnrealPak)
are ticked
- make sure
- choose your platform (only tested on
- Change
Package
toPackage and store locally
and leave everything unticked - Leave
Archive
unticked andDeploy
toDo not Deploy
- Run this launch profile, it should be successful. The packaged plugin content should be (by default) in the plugin folder
\Saved\StagedBuilds\Windows\ForPackage\Plugins\GameFeatures\<plugin-name>\
. You can copy this folder (containing theuplugin
andContent
subfolder) somewhere else (by default in the<ProjectFolder>/DLC
. We will need to give the path of this folder (the path to\<plugin-name>\
) to the AuroraPakLoader plugin to load this GameFeature
- In the
- Before Packaging the plugin, we need to package the project.
We also need to make sure that the plugin files are not packaged with the project, otherwise they will not be part of the plugin .pak file. The current most reliable way is the following:- Deactivate the plugin to package in
Edit > Plugins
. No need to restart the editor. - Package the base game in
Platforms > Project Launcher > Base Game Profile > Run
- When done, ensure the plugin files are absent in the Game .pak file with the UnrealPak.exe tool:
- Deactivate the plugin to package in
"C:\Program Files\Epic Games\UE_5.4\Engine\Binaries\Win64\UnrealPak.exe" "D:\<path>\<ProjectName>\Plugins\GameFeatures\<plugin-name>\Saved\StagedBuilds\Windows\<ProjectName>\Plugins\GameFeatures\<plugin-name>\Content\Paks\Windows\<plugin-name><ProjectName>-Windows.pak" -list
- We are now ready to package the plugin.
- Re-activate the plugin to package in
Edit > Plugins
. No need to restart the editor - Package the DLC plugin in
Platforms > Project Launcher > Plugin Profile > Run
- When done, ensure the plugin files are present in the Plugin .pak file with the UnrealPak.exe tool:
- Re-activate the plugin to package in
"C:\Program Files\Epic Games\UE_5.4\Engine\Binaries\Win64\UnrealPak.exe" "D:\<path>\<ProjectName>\Plugins\GameFeatures\<plugin-name>\Saved\StagedBuilds\Windows\<ProjectName>\Plugins\GameFeatures\<plugin-name>\Content\Paks\Windows\<plugin-name><ProjectName>-Windows.pak" -list
By default, the AuroraPakLoader plugin will Mount all the Pak Plugins located in the <ProjectFolder>/DLC
folder.
If Play the level, the Output log should give you information about the mounting and loading process. Also, you should see the content of the pak file in the Content
panel as a new Mounting Point was added in the Source
folder.
If you stop PIE, the content is will be unmounted.
If you unmount a currently loaded map, this will currently crash the game/editor
To manually load a map, you could call the BP function Open Level (by Name)
and give the path to the level, like /Stage_01/Maps/Stage_01_Map
.
Start playing and the map should get loaded.
By default, GameFeatures are not AutoActivated (they could be if preferred), but you can use GF Pak Loader Subsystem
to retrieve all the Pak Plugins with a Status of Mounted
and call the BP function Activate Game Feature
- As we need to package the plugin, I expect that the UE version of the project used to package needs to match the UE version of the project that will use the packaged content. To be tested.
- Currently, we code is setup in a way where we need to give a path to the packaged plugin directory containing the
.uplugin
file:
// We expect a packaged plugin directory to have these files and folders:
// plugin-name/
// plugin-name.uplugin
// Content/Paks/<platform>/plugin-name-and-additional-things.pak
We need the .uplugin
for the GameFeatureSubsystem
to work, and this also allow us to retrieve the name of the plugin and description (and all other information) which we could pull for the UI.