<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Marko Petrić</title>
    <description>The latest articles on Forem by Marko Petrić (@marko-ue).</description>
    <link>https://forem.com/marko-ue</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3921699%2F37f639a9-f894-4b3d-8f8a-2559e1ee8d79.png</url>
      <title>Forem: Marko Petrić</title>
      <link>https://forem.com/marko-ue</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/marko-ue"/>
    <language>en</language>
    <item>
      <title>GAS Input Tags: Ability Activation Without Hardcoded Bindings</title>
      <dc:creator>Marko Petrić</dc:creator>
      <pubDate>Sun, 24 May 2026 18:22:05 +0000</pubDate>
      <link>https://forem.com/marko-ue/gas-input-tags-ability-activation-without-hardcoded-bindings-2134</link>
      <guid>https://forem.com/marko-ue/gas-input-tags-ability-activation-without-hardcoded-bindings-2134</guid>
      <description>

&lt;h3&gt;
  
  
  What are input tags in GAS and why you should use them
&lt;/h3&gt;

&lt;p&gt;Input tags are one way of activating gameplay abilities in GAS. They allow you to easily tie any gameplay ability's activation input to a specific gameplay tag, instead of hardcoding bindings. If you're new to gameplay tags, &lt;a href="https://marko-ue.hashnode.dev/native-gameplay-tags-in-gas" rel="noopener noreferrer"&gt;my earlier post covers them&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Input tags also let you rebind or assign abilities at runtime without touching input code.&lt;/p&gt;




&lt;h3&gt;
  
  
  How to add an input tag to an ability
&lt;/h3&gt;

&lt;p&gt;The way input tags are added to abilities is by accessing that ability's spec, and adding your input tag to its dynamic spec source tags, which are just an &lt;code&gt;FGameplayTagContainer&lt;/code&gt; . They are carried over with that ability's spec, and can always be accessed if you have that spec.&lt;/p&gt;

&lt;p&gt;In my case, for adding input tags, I have an &lt;code&gt;FAbilitySet&lt;/code&gt; struct which lets me choose to add an input tag to any abilities I give, and lets me access the relevant spec more easily. I give these abilities with their relevant input tags when the game starts, but you can choose to add them in many places and at runtime. The tag you give can be either an editor or native gameplay tag, and you are not required to use a struct.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Maps abilities to input tags&lt;/span&gt;
&lt;span class="n"&gt;USTRUCT&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;FAbilitySet&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;GENERATED_BODY&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;UPROPERTY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EditDefaultsOnly&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;TSubclassOf&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;UGameplayAbility&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;AbilityClass&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;UPROPERTY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EditDefaultsOnly&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;FGameplayTag&lt;/span&gt; &lt;span class="n"&gt;InputTag&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;FAbilitySet&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;Set&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;StartupAbilities&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;FGameplayAbilitySpec&lt;/span&gt; &lt;span class="n"&gt;AbilitySpec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AbilityClass&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;AbilitySpec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetDynamicSpecSourceTags&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;AddTag&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;InputTag&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;GetAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GiveAbility&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AbilitySpec&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  How to activate an ability using an input tag
&lt;/h3&gt;

&lt;p&gt;Now that your ability has an input tag given to its dynamic spec source tags, you can check for it when using input.&lt;/p&gt;

&lt;p&gt;To check for it, in your input function, you can access the ability's spec, then use &lt;code&gt;GetDynamicSpecSourceTags&lt;/code&gt; on that spec, and check if it has the specific tag(s) you choose to pass in. In my case, I'm checking for the input tag for primary actions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;AComplyPlayerCharacter&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;PrimaryActionPressed&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;FGameplayAbilitySpec&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;Spec&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;GetAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetActivatableAbilities&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Spec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetDynamicSpecSourceTags&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;HasTagExact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;ComplyTags&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;ComplyAbilities&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;InputTags&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Input_Primary&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;GetAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;TryActivateAbility&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Spec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Handle&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So in the above example, when pressing the primary input, we loop over all activatable abilities on the &lt;code&gt;AbilitySystemComponent&lt;/code&gt;, and if an activatable ability has the &lt;code&gt;Input_Primary&lt;/code&gt; input tag, it will be activated.&lt;/p&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Input tags in GAS are a simple but highly useful and extendable system for handling input for activating abilities. What I've shown is just the basic template, but it's enough to set you up for creating your own advanced input system with things like holding input to activate abilities, or multi-tag checks.&lt;/p&gt;

&lt;p&gt;If you have any questions or feedback, feel free to contact me on LinkedIn, or email me: &lt;a href="mailto:petric.marko04@gmail.com"&gt;&lt;strong&gt;petric.marko04@gmail.com&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>unrealengine</category>
      <category>ue5</category>
      <category>gameplayabilitysystem</category>
      <category>cpp</category>
    </item>
    <item>
      <title>How to Deal Damage in Unreal's GAS: Meta Attribute and Execution Calculation Pattern</title>
      <dc:creator>Marko Petrić</dc:creator>
      <pubDate>Mon, 11 May 2026 15:38:00 +0000</pubDate>
      <link>https://forem.com/marko-ue/how-to-deal-damage-in-unreals-gas-meta-attribute-and-execution-calculation-pattern-3da7</link>
      <guid>https://forem.com/marko-ue/how-to-deal-damage-in-unreals-gas-meta-attribute-and-execution-calculation-pattern-3da7</guid>
      <description>

&lt;h2&gt;
  
  
  What are meta attributes and how to use them
&lt;/h2&gt;

&lt;p&gt;Most commonly, and in this example, a meta attribute will be used for damage. Meta attributes are placeholder attributes that act as intermediaries on which we perform all the necessary calculations before damage is actually applied. For projects that have more complex damage handling in which certain calculations should be performed before damage is applied (armor, buffs, resistances etc.), a meta attribute is a good choice. Meta attributes are also useful because they separate concerns between the damage dealer and the target, as the damage dealer doesn't need to know how the target handles its damage. Meta attributes are typically not replicated.&lt;/p&gt;




&lt;h3&gt;
  
  
  Making a meta attribute
&lt;/h3&gt;

&lt;p&gt;To make a damage meta attribute, you can make a regular attribute in your attribute set, which won't be replicated as damage should only be handled on the server, so there's no need for a &lt;code&gt;GetLifetimeReplicatedProps&lt;/code&gt; entry or an &lt;code&gt;OnRep&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;UPROPERTY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;BlueprintReadOnly&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Category&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"Meta Attributes"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;FGameplayAttributeData&lt;/span&gt; &lt;span class="n"&gt;IncomingDamage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;ATTRIBUTE_ACCESSORS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ThisClass&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;IncomingDamage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Using a meta attribute
&lt;/h3&gt;

&lt;p&gt;To use the meta attribute, in &lt;code&gt;PostGameplayEffectExecute&lt;/code&gt;, we can store the value of this meta attribute in a local variable to use it later, and immediately zero out the attribute so that any new damage starts at 0 instead of adding to previous values. Now, we can have a check for if the damage is above 0, in which case we can subtract from our health attribute with it, and then set the health to the result of that subtraction while clamping. Optionally, you can now also check if health is at or below 0.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EvaluatedData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Attribute&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;GetIncomingDamageAttribute&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;LocalIncomingDamage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GetIncomingDamage&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;SetIncomingDamage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;LocalIncomingDamage&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;0.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;NewHealth&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GetHealth&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;LocalIncomingDamage&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;SetHealth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;FMath&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;NewHealth&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;GetMaxHealth&lt;/span&gt;&lt;span class="p"&gt;()));&lt;/span&gt;

        &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;bFatal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;NewHealth&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mf"&gt;0.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The meta attribute is now ready to be used in ExecCalcs. The value that the ExecCalc outputs will be used here.&lt;/p&gt;




&lt;h2&gt;
  
  
  What are execution calculations and how to use them
&lt;/h2&gt;

&lt;p&gt;Execution calculations (commonly abbreviated as ExecCalc) are the most powerful and custom way to modify gameplay effects, such as the gameplay effect we will use to apply damage in this case. As opposed to magnitude calculation classes (MMC) which can only change one attribute, ExecCalcs are capable of changing multiple attributes.&lt;/p&gt;

&lt;p&gt;There are some important caveats to using ExecCalcs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;They don't support prediction&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They can only be used for instant and periodic gameplay effects (no infinite gameplay effects, but duration effects with periods can be used)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Capturing attributes doesn't run PreAttributeChange, so any clamping must be done again&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;They are only executed on the server from gameplay abilities with local predicted, server initiated, and server only net execution policies&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Snapshotting is another feature of ExecCalcs, and it captures the attribute value when the gameplay effect spec is created. Otherwise, when not snapshotting, attribute values are captured when the gameplay effect is applied. From the target, the values are always captured on effect application only - snapshotting only applies to the source. In other words, should an ability's damage be locked when the ability is activated or read when it hits the target it should apply damage to? This difference matters when you have something like buffs that can expire in between.&lt;/p&gt;

&lt;p&gt;Execution calculations are also capable of taking in set by caller magnitudes and using them in calculations, and they also supports calculation modifiers.&lt;/p&gt;

&lt;p&gt;The execution calculation class is created by inheriting from the &lt;code&gt;UGameplayEffectExecutionCalculation&lt;/code&gt; class, and is assigned in the Executions section of your gameplay effect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwhc8f5dpai6nvwzhysv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgwhc8f5dpai6nvwzhysv.png" alt="Image showing how to set an execution calculation class in a gameplay effect" width="800" height="101"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Using an execution calculation class
&lt;/h2&gt;

&lt;p&gt;The main function of ExecCalcs is the public &lt;code&gt;Execute_Implementation&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Execute_Implementation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;FGameplayEffectCustomExecutionParameters&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;ExecutionParams&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
&lt;span class="n"&gt;FGameplayEffectCustomExecutionOutput&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;OutExecutionOutput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="k"&gt;override&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function's first parameter is a const reference for execution parameters of the gameplay effect that's being applied, and the second parameter is a reference to the output of those same parameters, which is how this function modifies attributes (which will be seen later). The &lt;code&gt;ExecutionParams&lt;/code&gt; can be used to access different kinds of information, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;UAbilitySystemComponent&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;SourceASC&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExecutionParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetSourceAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;UAbilitySystemComponent&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;TargetASC&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExecutionParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetTargetAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="n"&gt;AActor&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;SourceAvatar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SourceASC&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;SourceASC&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetAvatarActor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;nullptr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;AActor&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;TargetAvatar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;TargetASC&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;TargetASC&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetAvatarActor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;nullptr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;FGameplayEffectSpec&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;Spec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExecutionParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetOwningSpec&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: In this post I won't cover capturing attributes or using their values in calculations. Instead I'll use a set by caller magnitude and feed its value directly into the damage meta attribute, just enough to show the ExecCalc → meta attribute pipeline clearly. I'll cover attribute capturing as a follow-up post.&lt;/p&gt;




&lt;h3&gt;
  
  
  Passing in a set by caller magnitude to the damage gameplay effect
&lt;/h3&gt;

&lt;p&gt;The way you handle applying the damage effect with your set by caller magnitude will depend heavily on how your code is set up. In my case, I have a function that all gameplay abilities that deal damage will have due to inheritance, which simply just makes the effect spec, gets that ability's damage (based on level), then assigns the set by caller magnitude with a damage type tag, and applies the gameplay effect to the target actor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// DamageEffectClass is a TSubclassOf of the damage gameplay effect&lt;/span&gt;
&lt;span class="n"&gt;FGameplayEffectSpecHandle&lt;/span&gt; &lt;span class="n"&gt;DamageSpecHandle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MakeOutgoingGameplayEffectSpec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="n"&gt;DamageEffectClass&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// The magnitude in my case is an FScalableFloat damage based on that ability's level. &lt;/span&gt;
&lt;span class="c1"&gt;// You can also just use regular floats here.&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;ScaledDamage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Damage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetValueAtLevel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;GetAbilityLevel&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="c1"&gt;// DamageType is a FGameplayTag variable for damage types set in the blueprints of my damage abilities, you can pass in any tag you want &lt;/span&gt;
&lt;span class="n"&gt;UAbilitySystemBlueprintLibrary&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;AssignTagSetByCallerMagnitude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="n"&gt;DamageSpecHandle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DamageType&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ScaledDamage&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;GetAbilitySystemComponentFromActorInfo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ApplyGameplayEffectSpecToTarget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;DamageSpecHandle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; 
&lt;span class="n"&gt;UAbilitySystemBlueprintLibrary&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;GetAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TargetActor&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Getting set by caller magnitude values in the execution calculation and modifying attributes
&lt;/h3&gt;

&lt;p&gt;Now that we pass in a set by caller magnitude to the gameplay effect that has the execution calculation set, we can get that magnitude, and in this case, just add that magnitude to our IncomingDamage meta attribute.&lt;/p&gt;

&lt;p&gt;To do this, we first need to get the gameplay effect's spec (the one that has the ExecCalc set). Then, we can store that damage by creating a local variable and getting the set by caller magnitude with our tag that we passed in when applying it. The last step is to create a &lt;code&gt;const FGameplayModifierEvaluatedData&lt;/code&gt; struct, which when initializing requires the attribute you want to modify (our meta attribute in this case), in what way you want to modify it, and the variable to modify it with. After the struct is initialized, you can call &lt;code&gt;AddOutputModifier&lt;/code&gt; on the &lt;code&gt;OutExecutionOutput&lt;/code&gt; , and pass in our initialized struct.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;UExecCalc_Damage&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Execute_Implementation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;FGameplayEffectCustomExecutionParameters&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;ExecutionParams&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                                           &lt;span class="n"&gt;FGameplayEffectCustomExecutionOutput&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;OutExecutionOutput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;FGameplayEffectSpec&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;Spec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ExecutionParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetOwningSpec&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;// Here I check my custom damage type tag to see if it was used to apply the set by caller magnitude&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;Damage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Spec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetSetByCallerMagnitude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ComplyTags&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;DamageTypes&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Damage_Physical&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;FGameplayModifierEvaluatedData&lt;/span&gt; &lt;span class="n"&gt;EvaluatedData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;UComplyAttributeSet&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;GetIncomingDamageAttribute&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; 
    &lt;span class="n"&gt;EGameplayModOp&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Additive&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Damage&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;OutExecutionOutput&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddOutputModifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EvaluatedData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the ExecCalc modifies the attribute, &lt;code&gt;PostGameplayEffectExecute&lt;/code&gt; will get called, and it will see our meta attribute was modified. It also handles clamping so we don't have to worry about caveat 3.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The meta attribute and execution pipeline is a great way to handle damage in games that require more complex setup. Now that the core system is in place, my follow-up posts will get into capturing attributes and using those values in the calculation.&lt;/p&gt;

&lt;p&gt;If you have any questions or feedback, feel free to contact me on LinkedIn, or email me: &lt;a href="mailto:petric.marko04@gmail.com"&gt;&lt;strong&gt;petric.marko04@gmail.com&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>unrealengine</category>
      <category>ue5</category>
      <category>gameplayabilitysystem</category>
      <category>cpp</category>
    </item>
    <item>
      <title>Native Gameplay Tags in GAS</title>
      <dc:creator>Marko Petrić</dc:creator>
      <pubDate>Sat, 09 May 2026 12:09:26 +0000</pubDate>
      <link>https://forem.com/marko-ue/native-gameplay-tags-in-gas-53lb</link>
      <guid>https://forem.com/marko-ue/native-gameplay-tags-in-gas-53lb</guid>
      <description>&lt;h3&gt;
  
  
  What are gameplay tags and why should you use them
&lt;/h3&gt;

&lt;p&gt;Gameplay tags are essentially &lt;code&gt;FName&lt;/code&gt; wrappers, meaning they have a small upfront cost when first created but are very cheap to access and compare after that.&lt;/p&gt;

&lt;p&gt;Gameplay tags are used as a clean way to handle things like character and actor state, input and ability activation, damage types and resistances, and communication between systems. GAS also has built-in tag requirements for gameplay abilities. Essentially, wherever you'd traditionally use booleans or enums, gameplay tags are generally the better choice when working with GAS.&lt;/p&gt;




&lt;h3&gt;
  
  
  What are native gameplay tags and why should you use them
&lt;/h3&gt;

&lt;p&gt;Native gameplay tags are tags created in C++, rather than in the editor.&lt;/p&gt;

&lt;p&gt;The main reasons for creating native gameplay tags rather than using editor ones is for type safety (autocomplete, no typo risk), which makes native ones safer, faster and easier to access through code.&lt;/p&gt;

&lt;p&gt;Note: Any gameplay tag changes made in blueprint reflect to C++ code and vice versa. The Ability System Component does not care about the source of changes.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Storing tags&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before creating native tags, you need a place to store them. A simple way would be to manually create empty &lt;code&gt;.h&lt;/code&gt; and &lt;code&gt;.cpp&lt;/code&gt; files. For context, my project is called Comply, and I will be using that prefix for my tags, so my files will be named ComplyTags.&lt;/p&gt;

&lt;p&gt;After creating these files, you need to use &lt;code&gt;#pragma once&lt;/code&gt; at the top of the &lt;code&gt;.h&lt;/code&gt; file, and to include &lt;code&gt;CoreMinimal.h&lt;/code&gt; and &lt;code&gt;NativeGameplayTags.h&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#pragma once
&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"CoreMinimal.h"&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;"NativeGameplayTags.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One way of storing tags, which lets you access specific tags cleanly, is to use namespaces. After creating a base namespace, each other namespace should be named based on the kind of tags it will store - so, for example, you could have a namespace called States for all state related gameplay tags, or Abilities for all ability asset tags. It's also possible to have namespace hierarchies.&lt;/p&gt;

&lt;p&gt;This is just one way of storing them, but you can try any approach and see what you'd prefer. In this practical example, namespaces will be used.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Declaring tags&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To declare tags, you use the &lt;code&gt;UE_DECLARE_GAMEPLAY_TAG_EXTERN&lt;/code&gt; macro, and pass in the name of the tag you wish to use, as shown below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;ComplyTags&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;ComplyAbilities&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;UE_DECLARE_GAMEPLAY_TAG_EXTERN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Primary_Ranger&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="n"&gt;UE_DECLARE_GAMEPLAY_TAG_EXTERN&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility_Ranger&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  &lt;strong&gt;Defining tags&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;After declaration, tags need to be defined, and this is handled in the &lt;code&gt;.cpp&lt;/code&gt; file for your tags. First, you need to include the &lt;code&gt;.h&lt;/code&gt; file for the tags here, which in my case is &lt;code&gt;ComplyTags.h&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"AbilitySystem/ComplyTags.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;.cpp&lt;/code&gt; file, you need to make sure your namespace names and hierarchies match with the structure created in the &lt;code&gt;.h&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;To define the tags, you use the &lt;code&gt;UE_DEFINE_GAMEPLAY_TAG&lt;/code&gt;, and optionally &lt;code&gt;UE_DEFINE_GAMEPLAY_TAG_COMMENT&lt;/code&gt; which unlocks a third parameter that lets you add a comment for your tag that can be seen in the editor. For this macro, the first parameter is the tag name (the same one you passed in when declaring the tag), then the tag hierarchy (which is how the tag can be accessed in the editor), and then, optionally, the comment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;ComplyTags&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;ComplyAbilities&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;UE_DEFINE_GAMEPLAY_TAG_COMMENT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Primary_Ranger&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"ComplyTags.Abilities.Ranger.Primary"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Primary ability asset tag for ranger"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;UE_DEFINE_GAMEPLAY_TAG_COMMENT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility_Ranger&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"ComplyTags.Abilities.Ranger.Utility"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Utility ability asset tag for ranger"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Accessing and using native tags
&lt;/h2&gt;

&lt;h3&gt;
  
  
  In the editor
&lt;/h3&gt;

&lt;p&gt;Any tags created natively appear in the gameplay tag list found in Project Settings, even among any tags you may choose to create in the editor.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle1h6pl21jg7b5qgnf3p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fle1h6pl21jg7b5qgnf3p.png" alt="An image showing gameplay tags in the editor" width="267" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They can be assigned in the editor for all purposes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6hk9b35jyjj32h526tz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6hk9b35jyjj32h526tz.png" alt="An image showing the usage of gameplay tags in the editor" width="613" height="35"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  In C++
&lt;/h3&gt;

&lt;p&gt;Using native gameplay tags in C++ is where they really prove their worth over ones created in blueprint. When accessing gameplay tags created in the blueprint through C++, you would often have to use &lt;code&gt;FGameplayTag::RequestGameplayTag(FName("Tag.Hierarchy"));&lt;/code&gt; which is prone to typos and has a slight overhead.&lt;/p&gt;

&lt;p&gt;For accessing native ones in code, you just have to include the &lt;code&gt;.h&lt;/code&gt; of where you store your native gameplay tags, which in my case is &lt;code&gt;ComplyTags.h&lt;/code&gt;, wherever you need to access them. Then, you type in the name of the base namespace, and use double colons to navigate to different namespaces and to a specific tag.&lt;/p&gt;

&lt;p&gt;Examples of using native gameplay tags in code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Checking if an actor has a certain tag&lt;/span&gt;
&lt;span class="n"&gt;FGameplayTagContainer&lt;/span&gt; &lt;span class="n"&gt;Tags&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;Character&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;GetOwnedGameplayTags&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Tags&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Tags&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HasTagExact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ComplyTags&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;States&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;State_Aiming&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;PlayMontageAndBindDelegates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AbilityActivationMontageIronsights&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Using a native gameplay tag to pass in a set by caller data tag&lt;/span&gt;
&lt;span class="n"&gt;FGameplayEffectContextHandle&lt;/span&gt; &lt;span class="n"&gt;ReserveAmmoContextHandle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GetAbilitySystemComponentFromActorInfo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;MakeEffectContext&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="n"&gt;FGameplayEffectSpecHandle&lt;/span&gt; &lt;span class="n"&gt;ReserveAmmoSpecHandle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;GetAbilitySystemComponentFromActorInfo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;MakeOutgoingSpec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="n"&gt;ActiveWeapon&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ReduceReserveAmmoEffectClass&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ReserveAmmoContextHandle&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;UAbilitySystemBlueprintLibrary&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;AssignTagSetByCallerMagnitude&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="n"&gt;ReserveAmmoSpecHandle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ComplyTags&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;SetByCaller&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;SBC_ReduceRifleReserveAmmo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;AmmoSpent&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;GetAbilitySystemComponentFromActorInfo&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;ApplyGameplayEffectSpecToSelf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;ReserveAmmoSpecHandle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Registering a gameplay tag event by passing in a native tag&lt;/span&gt;
&lt;span class="n"&gt;GetAbilitySystemComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;RegisterGameplayTagEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="n"&gt;ComplyTags&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;States&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;State_Aiming&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;EGameplayTagEventType&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;NewOrRemoved&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;AddUObject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;AComplyPlayerCharacter&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;OnAimingTagChanged&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  When you would prefer editor-created tags
&lt;/h3&gt;

&lt;p&gt;Native gameplay tags make sense when you are accessing them frequently in code, but editor tags are fine for quick one-off logic, for designers, or for quick prototyping.&lt;/p&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Although not required, native gameplay tags are a great alternative to editor-created tags for a multitude of reasons, and I would recommend everyone to try using them.&lt;/p&gt;

&lt;p&gt;If you have any questions or feedback, feel free to contact me on LinkedIn, or email me: &lt;a href="mailto:petric.marko04@gmail.com"&gt;petric.marko04@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>unrealengine</category>
      <category>ue5</category>
      <category>gameplayabilitysystem</category>
      <category>cpp</category>
    </item>
  </channel>
</rss>
