How to access variable from an ability in a widget? (GAS)

This is kind of a dumb question. So I have a float variable on my abilities that I’m trying to access in a widget:

The number value of the float corresponds to what type of ability it is, and I want to use this variable in a widget blueprint in order to set the order of abilities in my UI, but I can’t seem to figure out how to access the variable while I’m in the widget blueprint?

What do you mean ‘float variable on your abilities’? Is this in a derived GA? if so, you can getasc->getgetallabilities, then loop thru the spec handles it returns. for each handle getgameplayabilityfromspec, cast to your GA type then access the variable from there.

Yeah derived GA, should’ve specified that. I’ll try it!

What @Countsie mentioned is simply right, however it got my attention since you mentioned “UI Ordering”.

If this variable is just for UI ordering, like distinguishing skill 1, 2, 3, 4 or ability types, maybe you don’t need that float variable at all.

You can simply give your abilities gameplay tags.

EX:
Skill.Ranged
Skill.Melee

Then from the widget you can get ASC → FindAllAbilitiesWithTags and query Skill.Ranged, and it will return all granted ranged abilities on that ASC.

So instead of casting every ability just to read a float, you can just classify them by tags and retrieve the granted abilities from ASC directly.

If you need strict slot order, then yes you can also add tags like Skill.Slot.1 / Skill.Slot.2 or use some UI data asset that correlates order, icon, name etc., but for just grouping skill types, gameplay tags should already solve it.