# \[GAS\] Get Attribute by Name?

**URL:** <https://forums.unrealengine.com/t/gas-get-attribute-by-name/1204467>\
**Category:** C++\
**Tags:** Gameplay-Attributes, unreal-engine, Gameplay-Ability-System, Blueprint, CPP, question\
**Created:** [June 19, 2023, 7:06pm UTC](https://forums.unrealengine.com/t/gas-get-attribute-by-name/1204467 "2023-06-19T19:06:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BDC\_Patrick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bdc_patrick/32/1104221_2.png) [@BDC\_Patrick](https://forums.unrealengine.com/u/BDC_Patrick)\
**Post date:** [June 19, 2023, 7:06pm UTC](https://forums.unrealengine.com/t/gas-get-attribute-by-name/1204467/1 "2023-06-19T19:06:58Z")

</div>

Hi there…

I love GAS and i implemented around 50±5 Attributes in the system, my combat works… abilities are a dream 😍

But there is one thing i can’t get to work efficient…

Showing Attribute values inside UMG.

So… my first thought, the reason for this topic, was to have a Text Widget and name it f.e. “Text\_Attribute\_HP”.  
Now i get the Text Widget display name, replace “Text\_Attribute\_” with nothing and get an Attributes value based on the “HP” Text, so i can set the value as Text of the TextWidget.

i couldn’t find any Function that does that… But… Is there a way to receive an attributes value as easy as that idea?

Cause currently… my Switch on Enum Attributes… is hilariously long… and i need ro change everything when new attributes will be added… and if i need them to be shown in different widgets… i have all that stuff over and over again…

so… May one be so kindly to give me a direction, to get an attributes value as easy, Technically clean and manageable (and perhaps blueprint friendly) as possible, without needing to switchon an enum or a list or anything like that?

thanks in advance ❤

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [June 20, 2023, 10:32am UTC](https://forums.unrealengine.com/t/gas-get-attribute-by-name/1204467/2 "2023-06-20T10:32:09Z")

</div>

Is this not good ? Or am I getting your question wrong ?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/e/7ae282f27bb3c654bbe8cc870d8f73a5bb1447e4.png)

Here “Attribute” is a variable of type GameplayAttribute, which can even be editable/exposed so it can be defined in designer UI in parent widgets, or specified in ConstructWidget for dynamic ones.

Again, not sure what you’re after, but you can also iterate attributes and get their name and their value like this (using “break” on Attribute type gives name) :

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/f/f/afffa0c7dbb508ae4b2edac6a1cdf4165ca973c0.png)

Then you could dynamically create a list of “attribute:value” widgets for showing stats sheet or something…

---

<div class="post-metadata">

**Author:** ![BDC\_Patrick](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bdc_patrick/32/1104221_2.png) [@BDC\_Patrick](https://forums.unrealengine.com/u/BDC_Patrick)\
**Post date:** [June 20, 2023, 11:37am UTC](https://forums.unrealengine.com/t/gas-get-attribute-by-name/1204467/3 "2023-06-20T11:37:06Z")

</div>

The Last one is what i’m looking for.  
Thanks mate❤

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 20, 2023, 11:37am UTC](https://forums.unrealengine.com/t/gas-get-attribute-by-name/1204467/4 "2023-07-20T11:37:58Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
