ClearInvalidTags

ClearInvalidTags

#Overview

name: ClearInvalidTags

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ClearInvalidTags is to control whether invalid tags should be automatically cleared when reading saved tag references that are not present in the gameplay tag dictionary. This setting is part of the Gameplay Tags system in Unreal Engine 5.

The ClearInvalidTags variable is primarily used within the Gameplay Tags module of Unreal Engine. It is referenced in the GameplayTagsManager and GameplayTagsSettings classes, which are core components of the Gameplay Tags system.

The value of this variable is set in the UGameplayTagsSettings constructor, where it is initialized to false by default. It can be modified through the project settings in the Unreal Engine editor, as it is marked with the UPROPERTY macro and has the EditAnywhere specifier.

ClearInvalidTags interacts with other variables in the Gameplay Tags system, such as WarnOnInvalidTags and FastReplication. These variables collectively control the behavior of tag validation and replication in the engine.

Developers must be aware that enabling this setting can potentially alter saved data by removing tags that are no longer recognized. This could lead to unintended consequences if game logic relies on the presence of specific tags, even if they become invalid.

Best practices when using this variable include:

  1. Carefully considering the implications of enabling this setting, especially for projects with existing saved data.
  2. Using it in conjunction with the WarnOnInvalidTags setting to help identify and address invalid tags proactively.
  3. Maintaining a consistent tag dictionary across all versions of the game to minimize the occurrence of invalid tags.
  4. Testing thoroughly after enabling or disabling this setting to ensure it doesn’t negatively impact gameplay or saved data.
  5. Documenting any changes to this setting and communicating them to the development team to avoid unexpected behavior.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultGameplayTags.ini:4, section: [/Script/GameplayTags.GameplayTagsSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/GameplayTags/Classes/GameplayTagsSettings.h:110

Scope (from outer to inner):

file
class        class UGameplayTagsSettings : public UGameplayTagsList

Source code excerpt:

	/** If true, will clear any invalid tags when reading in saved tag references that are not in the dictionary */
	UPROPERTY(config, EditAnywhere, Category = GameplayTags, meta = (ConfigRestartRequired = true))
	bool ClearInvalidTags;

	/** If true, will allow unloading of tags in the editor when plugins are removed */
	UPROPERTY(config, EditAnywhere, Category = "Advanced Gameplay Tags")
	bool AllowEditorTagUnloading;

	/** If true, will allow unloading of tags in a non-editor gebuild when plugins are removed, this is potentially unsafe and affects requests to unload during play in editor */

#Loc: <Workspace>/Engine/Source/Runtime/GameplayTags/Private/GameplayTagsManager.cpp:559

Scope (from outer to inner):

file
function     void UGameplayTagsManager::ConstructGameplayTagTree

Source code excerpt:

			bUseFastReplication = MutableDefault->FastReplication;
			bShouldWarnOnInvalidTags = MutableDefault->WarnOnInvalidTags;
			bShouldClearInvalidTags = MutableDefault->ClearInvalidTags;
			NumBitsForContainerSize = MutableDefault->NumBitsForContainerSize;
			NetIndexFirstBitSegment = MutableDefault->NetIndexFirstBitSegment;

#if WITH_EDITOR
			if (GIsEditor)
			{

#Loc: <Workspace>/Engine/Source/Runtime/GameplayTags/Private/GameplayTagsSettings.cpp:63

Scope (from outer to inner):

file
function     UGameplayTagsSettings::UGameplayTagsSettings

Source code excerpt:

	ImportTagsFromConfig = true;
	WarnOnInvalidTags = true;
	ClearInvalidTags = false;
	FastReplication = false;
	AllowEditorTagUnloading = true;
	AllowGameTagUnloading = false;
	InvalidTagCharacters = ("\"',");
	NumBitsForContainerSize = 6;
	NetIndexFirstBitSegment = 16;