Hello,
So I do not know what the problem is, this was working quite well before, but now it is not. I have a USTRUCT that is in an array and all I need to do is access those items in blueprints. Here is the struct:
USTRUCT(BlueprintType)
struct FItemSlot {
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
FString Item_Name;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
UTexture2D* Item_Image;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
EItemTag Item_Tag;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
int32 Item_Weight;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
int32 Item_Value;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
FString Item_Description;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
int32 Item_Size;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
int32 Quantity;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
int32 Index;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Info)
TSubclassOf<class AItemBase> Item_Class;
int32 operator-=(int32 i) {
Quantity -= i;
return Quantity;
}
int32 operator+=(int32 i) {
Quantity += i;
return Quantity;
}
bool operator<(int32 i) {
return (Quantity < i);
}
bool operator>(int32 i) {
return (Quantity > i);
}
bool operator>=(int32 i) {
return (Quantity >= i);
}
bool operator<=(int32 i) {
return (Quantity <= i);
}
/*
Returns true if Name and Class are the same
*/
bool operator=(const FItemSlot& ItemSlot) const {
bool isSameSlot = false;
if (ItemSlot.Item_Name == Item_Name&&ItemSlot.Item_Class == Item_Class) {
isSameSlot = true;
}
return isSameSlot;
}
/*
Returns true if Name, Class and Index are the same
*/
bool operator==(const FItemSlot& ItemSlot) const {
bool isSameSlot = false;
if (ItemSlot.Item_Name == Item_Name&&ItemSlot.Index == Index&&ItemSlot.Item_Class==Item_Class) {
isSameSlot = true;
}
return isSameSlot;
}
FItemSlot() {
}
FItemSlot(TSubclassOf<AItemBase> item, int32 quantity, int32 index) {
Item_Class = item;
Quantity = quantity;
Index = index;
Item_Image = item.GetDefaultObject()->Image;
Item_Name = item.GetDefaultObject()->Name;
Item_Tag = item.GetDefaultObject()->tag;
Item_Weight = item.GetDefaultObject()->Weight;
Item_Size = item.GetDefaultObject()->Size;
Item_Value = item.GetDefaultObject()->Value;
Item_Description = item.GetDefaultObject()->Description;
}
};
Note: I can break the struct in blueprints, the problem occurs when I attempt to use those properties.
(Example: If I were to print Item_Name it would return “”, or if I were to return Quantity it would return 0)
Thank you