Knowledge Base: Loading Native Gameplay Tags

Thanks for the article @RudyTriplett!
Your approach in Fortnite seems robust and well designed. However, it requires Engine modification and compiling UE from source. I’ve stumbled upon this article which suggests adding Native Gameplay Tags on module startup. I’ve modified the code a bit since our project needed Native Gameplay Tags even before OnLastChanceToAddNativeTags is broadcasted from UGameplayTagsManager:

MyGame.h

#pragma once
#include "CoreMinimal.h"
DECLARE_LOG_CATEGORY_EXTERN(LogMyGame, Log, All);

class FMyGameGameModule final : public FDefaultGameModuleImpl
{
	virtual void StartupModule() override;
};

MyGame.cpp

#include "MyGame.h"
#include "MyGameGameplayTags.h"
#include "GameplayTagsManager.h"
#include "Modules/ModuleManager.h"

DEFINE_LOG_CATEGORY(LogMyGame)
IMPLEMENT_PRIMARY_GAME_MODULE(FMyGameGameModule, MyGame, "MyGame");

void FMyGameGameModule::StartupModule()
{
	// Initialize your Native Gameplay Tags using your custom singleton Tag Manager
	// Your custom singleton Tag Manager should make use of UGameplayTagsManager::Get().AddNativeGameplayTag() in its initialization
	FMyGameGameplayTags::InitializeNativeTags();
	// Notify the global GameplayTagsManager that we are done adding native tags
	UGameplayTagsManager::Get().DoneAddingNativeTags(); 
}
5 Likes