I’m setting up a game feature plugin which comes with its own set of gameplay tags. I know it’s possible to add these tags by specifying them one by one in a ini file under /MyPlugin/Config/Tags. However our team prefers setting up gameplaytags in datatables. Adding the DT reference to GameplayTagTableList as we do in the main project doesn’t seem to work:
`; OK
[/Script/GameplayTags.GameplayTagsList]
GameplayTagList=(Tag=“My.New.Tag”,DevComment=“”)
; Not OK
[/Script/GameplayTags.GameplayTagsSettings]
+GameplayTagTableList=/MyPlugin/PathToTagsDT/DT_MyTags.DT_MyTags`Is there any way to specify tags from a datatable in a gamefeatureplugin?
As you pointed out, when adding tags to the plugin ini it would work / be preferred to be added one by one.
It looks like table from outside of the main project’s ini file is ignored which stand to reason as to why adding the DT reference to the plugin isn’t working, but I could be wrong on this.
If you would like to keep data tables there’s two ways I can think of that could possibly work:
1.) If you don’t mind them being available to the whole project, you could add the data table to the main project and have the plugin reference them there assuming it loads and registers the tags before the plugin is used.
2.) Manually load the datatable through calls in GameplayTagsManager.cpp when the plugin is startup or ran with something like PopulateTreeFromDataTable(DataTable).
Please let me know if you would like additional information, or have any questions.
Hi John, thanks for the answer - sorry it took me a while to circle back to this. Most of the likely entry points for option 2 are private to the GameplayTagsManager. The only thing that might work that I could find would be parsing the DT myself and adding tags one by one using ImportSingleGameplayTag, but even that looks incomplete compared to what Populate… does (no addition of the tag to the TagNode tree for instance?).
We’re going to bite the bullet and convert the DTs to ini tag entries for now, but it looks like the support for gameplaytags DT in gamefeature plugins is something that should be added on Epic’s side to better mirror the capabilities of the main project.
Hey Ben, I’ve tried loading additional tags from Data Tables in plugins and have it working this way:
A C++ GameFeaturePlugin called PluginTagTest that calls in its StartupModule:
void FPluginTagTestRuntimeModule::StartupModule() { // Reload tag tables when this module is loaded UGameplayTagsManager::Get().LoadGameplayTagTables(false); }* A config file in the plugin: Plugins/GameFeatures/PluginTagTest/Config/GameplayTags.ini with the following content:
[/Script/GameplayTags.GameplayTagsSettings] +GameplayTagTableList=/PluginTagTest/DT_PluginTagTable.DT_PluginTagTableand then the tags defined in the plugin’s data table are loaded and selectable in editor. Does that work for you and achieve what your team wants?
About debugging why GameplayTags.ini doesn’t seem to be loaded (at least, not applied) to the settings, I’m not sure but I’ll ask a colleague if they have insights.
In the meantime, modifying the settings that are already in memory may work for your use case. Can you try the following on module start-up? I’m curious if this works and if this is an acceptable workaround for you until we get the ini loading properly.
`#include “GameplayTagsManager.h” include “GameplayTagsSettings.h”
…
void FPluginTagTestRuntimeModule::StartupModule()
{
if (UGameplayTagsSettings* Settings = GetMutableDefault())
{
// Add a hardcoded tag table path to the list
const FSoftObjectPath MyTagTable(“/PluginTagTest/DT_PluginTagTable.DT_PluginTagTable”);
Settings->GameplayTagTableList.Add(MyTagTable);
// Reload tag tables when this module is loaded
UGameplayTagsManager::Get().LoadGameplayTagTables(false);
}
}`What might be relevant is: what is the initial state of your GFP? So I’m curious about your GFP’s uplugin values for:
{ ... "EnabledByDefault": true, "ExplicitlyLoaded": false, "BuiltInInitialFeatureState": "Active" }as well as what the Initial State and Current State says in the plugin’s GameFeatureData data asset.
Thanks! That works in editor but in cooked it triggers a crash:
LogGarbage: Warning: Disregard for GC object GameplayTagsManager /Engine/Transient.GameplayTagsManager_2147482626 referencing DataTable /MyPlugin/Tags/DT_Tags.DT_Tags which is not part of root set
Encountered 1 object(s) breaking Disregard for GC assumptions. Please check log for details.
Incidentally, instead of hardcoding I also tried feeding the softobjectpath from another config of the plugin and that was empty, so I’d assume the GFP configs are loaded only after the StartupModule, which would explain why the LoadGameplayTagTables call would not take into account the additional tables provided by the GFP. Is there any other plugin init callback I could hook to that is triggered after the config load?
Lastly, regarding the plugin initial state: that specific GFP is always loaded and active, though I don’t expect that to be the case for other GFPs we’d like to put in place.
I have found an earlier [EPS [Content removed] regarding the same topic. My latest suggestion working in editor is somewhat good news, but it seems our past recommendation has been to only let GFPs specify more tags via the one-by-one in INI route.
You might make some more progress if you add the loaded DataTable to the root set (DataTable->AddToRoot()) at runtime, but since this workaround is against my colleague’s earlier recommendations there may be more issues after that. There are also pitfalls if your project is multiplayer and GFPs are dynamically loaded/unloaded, which Ben describes in the linked question. You must ensure the same GFPs are loaded on server and client, so they have the same tag tree.
Thanks, that’s a very interesting thread you found! Well I guess that was worth a try, thanks again for taking a look. We’ll do the one-by-one in INI that’s fine.
Hi Zhi Kang,
Thanks for the follow-up! That’d be perfect, but unfortunately I can’t make it work neither in my main project nor in a smaller repro. Best I can see the explicit call to LoadGameplayTagTables doesn’t change anything because the GameplayTagsSettings’s GameplayTagTableList is not updated with the additional values of the ini file in the gamefeature plugin. This is weird because I have some gamefeature-specific configs [MyPluginName]Game.ini and [MyPluginName]Editor.ini and these do work as expected in term of adding new values to existing config objects. I’m not sure why GameplayTags.ini or [MyPluginName]GameplayTags.ini do not seem to be parsed. Any suggestion? Do you have any non-standard setup in your repro project?