# Array element getting reset to default

**URL:** <https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487>\
**Category:** Blueprint\
**Tags:** UProperty, unreal-engine, Blueprint, question, CPP\
**Created:** [July 28, 2016, 10:12pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487 "2016-07-28T22:12:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_d9f241d9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d9f241d9](https://forums.unrealengine.com/u/anonymous_user_d9f241d9)\
**Post date:** [July 28, 2016, 10:12pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/1 "2016-07-28T22:12:42Z")

</div>

I have an array of structs that, when edited in the details panel, always reset back to the values set in the blueprint object. The array has uproperty flags: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = SomewhereElse).

The array is visible and editable in the details panel, but any time one of the properties is edited on an instance of the object, the values get instantly reset back to the values set in the blueprint.

There is no construction script on my actor, and when I add one to print the value, it prints the value from the default, meaning that this is occurring before the construction script is called on the actor.

What would cause this kind of behavior?

---

<div class="post-metadata">

**Author:** ![eXi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/exi/32/906583_2.png) [@eXi](https://forums.unrealengine.com/u/eXi)\
**Post date:** [July 29, 2016, 5:28am UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/2 "2016-07-29T05:28:56Z")

</div>

Buh, so you place the Actor in the Level, fill in the Data, and if you modify one of the instances in terms of code, the Data gets reset?

OR, I setting the Data on a placed Actor directly resulting in them resetting again?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d9f241d9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d9f241d9](https://forums.unrealengine.com/u/anonymous_user_d9f241d9)\
**Post date:** [July 29, 2016, 4:45pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/3 "2016-07-29T16:45:11Z")

</div>

I have a blueprint with some values set. When I place the actor in the level and attempt to modify or add data in the details panel, it resets back to the values in the blueprint. Adding members of the array isn’t allowed. This is all in white text, not the grey of a uproperty disallowance.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0df12f74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0df12f74](https://forums.unrealengine.com/u/anonymous_user_0df12f74)\
**Post date:** [July 29, 2016, 5:50pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/4 "2016-07-29T17:50:54Z")

</div>

Could you take a screenshot showing how you are handling the array in blueprints?

Making changes will cause the construction script to re-run, so if you are setting the default values there it will discard your changes and reload the script.

---

<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:** [July 29, 2016, 6:06pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/5 "2016-07-29T18:06:50Z")

</div>

Hey Tiskahar-

In addition to the screenshots mentioned, can you also provide how youre code class is setup? Are you using ArrayName.Add() to add any elements to the array in code? Please provide the code for the arrays as well as the screenshots of your blueprints

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d9f241d9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d9f241d9](https://forums.unrealengine.com/u/anonymous_user_d9f241d9)\
**Post date:** [August 2, 2016, 5:39pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/6 "2016-08-02T17:39:49Z")

</div>

Sure thing!

My Struct is defined:

```
USTRUCT(BlueprintType)
struct FInteraction
{
	GENERATED_BODY()

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Interact|Type")
	EInter_Anim InterEnum;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Interact|Distance")
	float Distance;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Interact|Offset")
	FVector RelLocation;

	//UIWidget Type

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Interact|Offset")
	FString String;	

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dispatcher")
	TSubclassOf<class AIconActor> IconToSpawn;

	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interact|Component")
	TArray<FComponentListItem> ComponentList;

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Interact|Component")
	USceneComponent* ComponentToHover;

	UPROPERTY(EditAnywhere, Category = "Test")
	int32 TestNum;

	//Constructor
	FInteraction()
	{
		//Always initialize your USTRUCT variables!
		// exception is if you know the variable type has its own default constructor

		InterEnum = EInter_Anim::ETD_NONE;
		Distance = 0.0f;
		RelLocation = FVector(0.0f, 0.0f, 0.0f);
		String = "No Text Set";

	}
};

```

My Array is defined:

```
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = SomewhereElse)
	TArray<FInteraction> InteractionModes;

```

Here is a screenshot of my blueprint, where I am setting some values:

[[Album] imgur.com ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/c/0/bc07436038121779c1a9a2cb03899a3d4f12e779.jpeg "imgur.com") ](https://imgur.com/a/0CDXR)

Here is a video of me trying to edit the items.

---

<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:** [August 2, 2016, 7:25pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/7 "2016-08-02T19:25:48Z")

</div>

Hey Tiskahar-

I copied the struct into a new project and did not see the same behavior shown in your video. Do you have the same issue with the values not holding with other struts? If you copy this struct to a new project, does it still show the same issue?

---

<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:** [August 22, 2016, 7:19pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/8 "2016-08-22T19:19:49Z")

</div>

Hey Tiskahar-

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will follow up.

---

<div class="post-metadata">

**Author:** ![RealAero](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/realaero/32/716140_2.png) [@RealAero](https://forums.unrealengine.com/u/RealAero)\
**Post date:** [December 10, 2023, 9:30pm UTC](https://forums.unrealengine.com/t/array-element-getting-reset-to-default/365487/9 "2023-12-10T21:30:53Z")

</div>

I am encountering this now in 5.3.2. Seems to be a problem.

In my case, with a Editor Widget Utility, I add a set of “sub” actors to an array within a “master” actor, and then change any other variables in the “master” actor, it clears the array of “sub” actors.
