Help with C++ structure pointers and blueprints

bennur_1206
Fri, 22 Sep 2023 14:53:18 +0000
C++

I have a structure as:

USTRUCT(BlueprintType)
struct Fattribute_data
{
      float value = 0.0f;
      float minimum_value = 1.0f;
      float maximum_value = 1.0f;
}

I wish to create many such struct variables in a blueprint class and set their values in Class Defaults, like health, mana, stamina, armour etc.

I wish to have a variable in C++ such as:

TMap<MyEnum, Fattribute_data*>

such that, when I create the struct variable(s) in Blueprints and pass them to a blueprint callable method, I wish to have those structs mapped inside that TMap.

But, what is happening is, when I create some Fattribute_data variables such as health, mana, stamina in blueprints and set their values, the function creates the TMap, but upon accessing any value of the TMap using any key, I get only the last struct’s values.

I do not get the values of other structs.

Please help me.

How to write a function that can create such a map where any blueprint struct can simply have it’s address mapped by a TMap variable such as that?

Thanks.

5 posts - 3 participants