Does anyone know of a solution for modifying a struct property by reference by name? I’ve a struct containing my players attributes and a passive system in place for earning additional bonuses to those attributes.
The problem is I’ve around 30 passives. The only solution I could find thus far is to have a giant switch statement with 30 options, but it’s really unmanageable and frankly lags the editor in that BP.
Ideally it’d be great to be able to just modify the struct reference variable by the struct variable name. Has anyone figured out how to do this?
My struct defines the attributes, which are then a part of a table. The table contains all the attributes for all the player characters. When the character loads in their struct is pulled from the table and assigned to them. That struct is then modified by reference to adjust their attributes when they get a pickup or passive for example.
The only way I’d be able to use a map in this scenario is I guess convert the struct into a map, but that’s not doable either as some attributes are float, some are int, some are bool, etc..
My entire ability system is already designed with this struct in mind and I’m not about to rewrite a substantial amount of code to change that, lol. I know variables can be accessed by name in C++. If the same works for struct then I’ll look into make a BP node for this.