Description

If used inside a UMG Blueprint, a struct that has only one element will remove the element from the struct after compiling the blueprint. If the element is edited or a second element is added then this does not occur.

This behavior is inconsistent with a struct inside an Actor blueprint where the element won't be removed on compile.

Steps to Reproduce

1. Open UE4Editor (code project)
2. In the Project.Build.cs file add UMG, Slate, and SlateCore modules
3. In Project.h add the following includes:

#include "Runtime/UMG/Public/UMG.h"
#include "Runtime/UMG/Public/UMGStyle.h"
#include "Runtime/UMG/Public/Slate/SObjectWidget.h"
#include "Runtime/UMG/Public/IUMGModule.h"
#include "Runtime/UMG/Public/Blueprint/UserWidget.h"

4. In the editor, use the new class wizard to create a class based on UserWidget (MyWidget)
5. In MyWidget.h add the following above the class declaration

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"),
};

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;

};

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;

};

USTRUCT()
struct FToolTipElementStruct
{
	GENERATED_USTRUCT_BODY()

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

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

};

6. In the MyWidget.h class declaration, add the following:

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

7. Compile the code
8. In the editor create 2 UserWidget Blueprints (DummyBP and TestBP)
9. In DummyBP, File->Reparent Blueprint->MyWidget and compile
10. in TestBP, find DummyBP in the Palette and add it to the Designer
11. With DummyBP selected find the Tool Tips section in the details panel and press the + to add an element to Tool Tip Values array
12. Compile the blueprint

Result:
The element added to the array will be removed after the compile.

Expected:
Array elements are not cleared after compile.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Cannot Reproduce
ComponentUE - Gameplay - Blueprint
Affects Versions4.9.2
Target Fix4.11
CreatedOct 7, 2015
ResolvedOct 29, 2015
UpdatedApr 27, 2018