Enum Properties fail to copy/paste in the editor

This only seems to apply when using enums in structs. As an example:

UENUM(BlueprintType)
namespace ETestProperty
{
	enum Type
	{
		PrimaryElement		UMETA(DisplayName = "Primary Element"),
		SecondaryElement	UMETA(DisplayName = "Secondary Element"),
		Count
	};
}

Referencing this type as a just an enum, or even an array of enum is fine. If I copy a property, I get something like this in the copy/paste buffer:

PrimaryElement

But if I have the enum within a struct:

USTRUCT(BlueprintType)
struct FTestProperty
{
	GENERATED_USTRUCT_BODY()
	
	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Test")
	TEnumAsByte<ETestProperty::Type> Type;

	UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Test")
	float Value;
};

Copying that in the editor (right click on the structure and select copy), the copy/paste buffer contains this:

(Type=Primary Element,Value=0.000000)

That space in the name “Primary Element” seems to cause issues when I then paste into another structure. These problems magically disappear if I remove the spaces from the Display Names. But that means hard to names in the editor.

It seems that the copy/paste behaviour shouldn’t be using the Display Name as the Type (but does when copying the enum from within a struct).

I’m attaching a VERY simple test project. You can see the issue if you open up the TestAsset, and copy the 0’th element of the Test Property to the first (the float value will be copied, but the type field will remain unchanged).

I can obviously work around this by removing spaces from the display names (or adding underscores?). But it would be nice to get a fix.

Thanks.

For those editing engine source code, a simple solution is to edit the PropertyByte source file. Specifically the ExportTextItem function. You’ll want to NOT let unreal call GetEnumTextByValue, which returns the Display Name for the enum. I just added a “&& false” to the condition to prevent it being called.

Hey Ruminant-

This is a known bug (UE-21439) that is currently open for investigation. Thank you for the sample project which will help show exactly what the issue is.

Cheers

Is there any progress on this? I’m having enums within structs being set to INVALID when the struct is copied and pasted in 4.10 release

Hey -

I checked the status of the ticket I had entered, and it is still open. Unfortunately we do not have any estimate for when it will be resolved. However, I have added a comment to the ticket to indicate this is still affecting people.

Cheers

I see the problem still remains in 4.11.

I have some large arrays of structs and currently can’t move them to another blueprint where they belong without losing all the data and manually having to handcraft them again.

Strange that this hasn’t got higher attention. You would think a faithful copy/paste operation would be important.