I have created a struct that is passed to blueprints via a UObject function. Using a debugger and UE_LOGs, I have confirmed the struct data exists as populated when the getter function is being called. However, in blueprints, the struct return value is being read as having the default values instead of the populated values. I have never had this issue before with structs, and for the life of me, I cannot figure out what’s going on.
Does anyone have any ideas about what might be the problem?
USTRUCT(BlueprintType)
struct FMyStruct
{
GENERATED_BODY()
/**
*
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FString String1 = "Default Value";
/**
*
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FString String2 = "";
/**
*
*/
UPROPERTY(BlueprintReadWrite, EditAnywhere)
FString String3 = "";
};
UCLASS(BlueprintType, DefaultToInstanced, EditInlineNew)
class UMyObject : public UObject
{
GENERATED_BODY()
public:
// Attempt 1
UFUNCTION(BlueprintCallable, BlueprintPure)
const FMyStruct& GetStruct();
// Attempt 2
UFUNCTION(BlueprintCallable, BlueprintPure)
MyStruct& GetStruct();
// Attempt 3
UFUNCTION(BlueprintCallable)
MyStruct& GetStruct();
// Attempt 4
UFUNCTION(BlueprintCallable)
void GetStruct(FMyStruct& MyStruct);
};