Attributes

Attributes are values that define stats for your GameplayAbilitySystemComponent e.g. health, stamina, speed.
SimpleGAS gives you two types of attributes to work with: Float Attributes for simple numbers and Struct Attributes for more complex data.

Float Attributes

  • Attribute Name: A friendly label to help you identify the attribute in the editor
  • Attribute Tag: A unique gameplay tag that identifies this attribute
  • Base Value: A “permanent” value that represents the inherent stat
  • Current Value: The actual value used during gameplay that can be modified temporarily
    • For example, a character might have a Base Strength of 10, but a Current Strength of 15 due to a temporary buff. When the buff wears off, the Current Strength goes back to the Base Value.
  • Value Limits: Optional min/max boundaries for the attribute

Tip: You can choose to only use Current Value if that’s all you need - the Base Value is there in case you want that extra layer of “permanent vs temporary” changes.

Here’s what a Float Attribute looks like in the editor: Float attribute in the editor

Struct Attributes

Sometimes a simple number isn’t enough. That’s where Struct Attributes come in - they can store complex data like inventory items, skill trees, or any custom struct you create.

Struct Attributes have:

  • Attribute Name: A friendly label to help you identify the attribute in the editor
  • Attribute Tag: A unique gameplay tag that identifies this attribute
  • StructType: The struct type this attribute represents
  • StructAttributeHandler: On optional handler object class reference that you can use to send fine grained events when the attribute changes

Here’s an example of a Struct Attribute in the editor: Struct attribute in the editor

How To Modify Attributes

Float Attributes
  1. Calling the SetFloatAttribute function on the GamplayAbilitySystemComponent that owns the attribute:
    a screenshot of the SetFloatAttributeValue function

  2. Using an Attribute Modifier:
    a screenshot of a simple attribute modifier changing a float

Struct Attributes
  1. Calling the SetStructAttribute function on the GamplayAbilitySystemComponent that owns the attribute:
    a screenshot of the SetStructAttributeValue function

  2. Using an Attribute Modifier:
    a screenshot of a simple attribute modifier changing a struct
    Inside the struct modification function:
    a screenshot of a function callback when modifying a struct attribute with an attribute modifier

How To Listen For Changes

When an attribute changes, SimpleGAS automatically sends an event through the Simple Event Subsystem so other systems (like your UI) can react to the change.
You can find a list of the available events on the Event Reference page.

Float Attributes
  1. Listen for the appropriate event in the Simple Event Subsystem: a screenshot of listening for a change in float attribute value
  2. Use the WaitForFloatAttributeChanged latent node: a screenshot of the WaitForFloatAttributeChanged node
Struct Attributes
  1. Listen for the appropriate event in the Simple Event Subsystem: a screenshot of listening for a change in struct attribute value
  2. Use the WaitForStructAttributeChanged latent node: a screenshot of the WaitForStructAttributeChanged node

Struct Attribute Handlers

Struct attributes are a bit different from float attributes when it comes to the event that gets sent.

When a struct attribute changes, the entire struct is replaced. This presents a problem for when we are modifying the struct. Even though we know which struct members changed there is no easy way to automatically send an event for each member that changed.
To get around this, you can create a StructAttributeHandler class to send fine-grained events when the attribute changes.

To create a struct attribute handler, create a new blueprint class that inherits from UStructAttributeHandler. This class only has a single function to implement called GetModificationEvents. It takes as input two FInstancedStruct parameters (the old struct and the new one) and returns an FGameplayTagContainer with the tags representing the members of the struct that changed: a screenshot of a struct attribute handler implementation
The GetModificationEvents function will be called whenever the struct attribute changes and you can use it to determine which fields in the struct changed.
You can then listen for the corresponding struct member events. If no StructAttributeHandler is set on the struct attribute definition, you’ll still receive an event when the struct changes, but it won’t have any ModificationTags in it.

Attribute Sets

If you find yourself creating the same attributes for different characters, Attribute Sets can help. They’re reusable collections of attributes that you can add to any ability component.

To create an Attribute Set:

  1. Right-click in the content browser
  2. Choose Create → Data Asset
  3. Select “Attribute Set” as the class
  4. Add your attributes to the set

Now you can add this set to any ability component instead of manually recreating the same attributes.

Here’s what the attribute set looks like in the editor:
a screenshot of an attribute set

Adding an attribute set to an ability component:
a screenshot of an attribute set reference on an ability component