Bug: TArray of UStruct empties on compile when UStruct is left unchanged

Hey team,

I have run into an issue where a custom c++ UStruct will be cleared on a blueprint compile if it only has a single item within it if the item has not been modified. It works fine with 2, or with a changed single UStruct.

Video of bug:
https://youtu.be/NhkbWP7176w

This is running in a brand new widget blueprint with no functions. The array/ustruct structure is as follows:

//Within MyTestClass.h, which is the parent class of the UMG widget

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tool Tips")
		TArray<FToolTipElementStruct> ToolTipValues;

Enum - ELuaParameterType

UENUM(BlueprintType)
enum class ELuaParameterType : uint8
{
	LFPT_Float 	UMETA(DisplayName = "Float"),
	LFPT_String 	UMETA(DisplayName = "String"),
	LFPT_Int32	UMETA(DisplayName = "Int32"),
	LFPT_Bool UMETA(DisplayName = "Bool"),
};

FToolTipElementStruct

USTRUCT()
struct FToolTipElementStruct
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tool Tips")
	FLuaFunctionStruct Data;
	
	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Tool Tips")
		FText TitleText;

};

FLuaFunctionStruct

USTRUCT()
struct FLuaFunctionStruct
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
	FString functionName;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
		FString memberObjectInstance;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
		TArray<FLuaFunctionParameter> parameters;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
		TArray<FLuaFunctionParameter> returnParameters;

};

FToolTipElementStruct

USTRUCT()
struct FLuaFunctionParameter
{
	GENERATED_USTRUCT_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
	ELuaParameterType type;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
		float floatValue;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
		int32 intValue;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
		FString stringValue;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Lua Function")
		bool boolValue;

};

Cheers,
Mugen

Hey -

I tried to copy the STRUCTS you posted into a custom class but received compile errors. Let me know if there is any additional code that these structs rely on or if you can provide steps to follow so that my setup matches yours?

Cheers

Hey ,

that would be because you’re missing the custom enum I guess? Also you will need to add USTRUCT() to the top of both FLuaFunctionStruct & FLuaFunctionParameter - I have updated the code above as I missed adding these.

ELuaParameterType:

UENUM(BlueprintType)
enum class ELuaParameterType : uint8
{
	LFPT_Float 	UMETA(DisplayName = "Float"),
	LFPT_String 	UMETA(DisplayName = "String"),
	LFPT_Int32	UMETA(DisplayName = "Int32"),
	LFPT_Bool UMETA(DisplayName = "Bool"),
};

Cheers,

What class is MyTestClass the child of? I tried adding the structs/enum to a class based on Actor and when I created a BP based on my class the struct did not clear on compile as shown in the video. If I try to create a class related to UMG my choices are UMGMovieSceneObjectManager or UMGSequencePlayer. Let me know if you’re using one of these as the parent to MyTestClass or if you’re using another class instead.

MyTestClass is a child of UUserWidget.

To actually access that class I create a widget blueprint, call it TestWidgetBlueprint and change its class to MyTestClass.

Then create another widget blueprint, call it TestClassExampleWidget and add a TestWidgetBlueprint to it. You can then select the TestWidgetBlueprint and find the tool tips section in the designer to try add the return parameter.

For reference:

UCLASS()
class AUTOMATIONGAME_API UMyTestClass : public UUserWidget
{
	GENERATED_BODY()

public:

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Tool Tips")
		TArray<FToolTipElementStruct> ToolTipValues;
};

Hey -

I was able to reproduce the array element being removed during a compile. This seems isolated to using the struct/array inside UMG as I did not get the same behavior for an actor class. This bug has been reported (UE-21877) for further investigation.

Cheers