Array element getting reset to default

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?

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?

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.

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.

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

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:

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

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?

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.

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.