# Dynamically add SourceTag to GE modifiers

**URL:** <https://forums.unrealengine.com/t/dynamically-add-sourcetag-to-ge-modifiers/2762882>\
**Category:** Programming & Scripting\
**Tags:** Gameplay-Effects, unreal-engine, Gameplay-Ability-System, question, CPP\
**Created:** [September 5, 2026, 7:50am UTC](https://forums.unrealengine.com/t/dynamically-add-sourcetag-to-ge-modifiers/2762882 "2026-09-05T07:50:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jw5a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jw5a](https://forums.unrealengine.com/u/jw5a)\
**Post date:** [September 5, 2026, 7:50am UTC](https://forums.unrealengine.com/t/dynamically-add-sourcetag-to-ge-modifiers/2762882/1 "2026-09-05T07:50:59Z")

</div>

I have a GE for an Block attribute and I want to be able to add block chance based on different conditions. E.g. block physical attack chance, block elemental spell chance, …

I got different tags such as Damage.Physical, Damage.Elemental, Ability.Attack, Ability.Spell. Instead of creating 4 GEs for each combination I wanted to use these tags as SourceTags for a single GE\_Block and add the tags programmatically in cpp.

I tried to add a function similar to this:

```cpp
bool UCustom_BlueprintLibrary::AddTagsToGameplayEffectModifier(
	const UGameplayEffect* GameplayEffect,
	const FGameplayTagContainer& SourceTags,
	const FGameplayTagContainer& TargetTags
) {
	if (GameplayEffect->Modifiers.IsEmpty()) return false;
		
	auto Modifier = GameplayEffect->Modifiers[0];
	
	if (SourceTags.IsValid())
	{
		Modifier.SourceTags.RequireTags.AppendTags(SourceTags);
	}
	
	if (TargetTags.IsValid())
	{
		Modifier.TargetTags.RequireTags.AppendTags(TargetTags);
	}
	
	return true;
}

```

However, no matter what I try, it seems it is not possible to modify the existing modifiers. Any Idea how I can achieve this behavior without defining GEs for every combination?

Edit: another approach I tried

```cpp
bool UCustom_BlueprintLibrary::AddTagToGameplayEffectModifier(
	const UGameplayEffect* GameplayEffect,
	const FGameplayAttribute& Attribute,
	const FGameplayTag& SourceTag,
	const FGameplayTag& TargetTag
) {
	if (GameplayEffect->Modifiers.IsEmpty()) return false;

	const auto Modifier = GameplayEffect->Modifiers.FindByPredicate(
	[&](const FGameplayModifierInfo& Item)
		{
			return Item.Attribute == Attribute;
		}
	);
	
	if (Modifier == nullptr) return false;
	
	if (SourceTag.IsValid())
	{
		auto Tags = Modifier->SourceTags.RequireTags;
		Tags.AddTag(SourceTag);
	}
	
	if (TargetTag.IsValid())
	{
		auto Tags = Modifier->TargetTags.RequireTags;
		Tags.AddTag(TargetTag);
	}
	
	return true;
}

```
