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

**URL:** <https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281>\
**Category:** Blueprint\
**Tags:** unreal-engine, bug-report, feedback, UE4, CPP, Blueprint, question\
**Created:** [October 5, 2015, 4:22am UTC](https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281 "2015-10-05T04:22:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MugenCity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MugenCity](https://forums.unrealengine.com/u/MugenCity)\
**Post date:** [October 5, 2015, 4:22am UTC](https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281/1 "2015-10-05T04:22:33Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [October 5, 2015, 6:21pm UTC](https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281/2 "2015-10-05T18:21:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MugenCity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MugenCity](https://forums.unrealengine.com/u/MugenCity)\
**Post date:** [October 6, 2015, 8:43pm UTC](https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281/3 "2015-10-06T20:43:29Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [October 6, 2015, 9:19pm UTC](https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281/4 "2015-10-06T21:19:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MugenCity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MugenCity](https://forums.unrealengine.com/u/MugenCity)\
**Post date:** [October 6, 2015, 9:36pm UTC](https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281/5 "2015-10-06T21:36:32Z")

</div>

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;
};
```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2b03d27c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2b03d27c](https://forums.unrealengine.com/u/anonymous_user_2b03d27c)\
**Post date:** [October 7, 2015, 2:55pm UTC](https://forums.unrealengine.com/t/bug-tarray-of-ustruct-empties-on-compile-when-ustruct-is-left-unchanged/334281/6 "2015-10-07T14:55:55Z")

</div>

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
