[GAS] Get Attribute by Name?

Hi there…

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

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 :heart:

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

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) :

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

1 Like

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

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