Alexa.Ki
(Alendromeda.ki)
August 7, 2022, 1:11am
1
Hi, I want to know how I can create a struct from its member reference ?
after creating it I want to set/add data to it
.
I tried this but it always failed.
.h
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TArray<FST_ItemTypeAndID> StructArrayRef;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
FST_ItemTypeAndID StructRefTemp;
.cpp
StructArrayRefTemp.ID = //my data
StructArrayRefTemp.Type = //my data
StructArrayRef.Add(StructRefTemp);//Adding elements
herb64
(herb64)
August 7, 2022, 6:25am
2
Do I understand correctly, that your struct is defined in Blueprint? In this case, I recommend to move your struct definition to the C++ side, so you can easily have access in C++ as well as in Blueprint.
Alexa.Ki
(Alendromeda.ki)
August 7, 2022, 10:51am
3
Sir thank you for reply, my FST_ItemTypeAndID
i s already defined in C++ side in class MyItemsGroups.h
USTRUCT(BlueprintType)
struct FST_ItemTypeAndID : public FTableRowBase
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
EItemType Type;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
FName ID;
};
Alexa.Ki
(Alendromeda.ki)
August 7, 2022, 10:57am
4
Here is the full code of this issue, I think I am getting infinite loop because of this failed cast to struct.
Infinite Loop