Description

If an object containing a struct is instanced inline inside ActorComponent, the properties of the struct cannot be edited. This only happens if the ActorComponent is added to a class by using CreateDefaultSubobject in a code constructor. If the ActorComponent is added through the Blueprint Editor, the property can be edited.

Steps to Reproduce
  1. Create a new code project using the Third Person template, no starter content.
  2. Build the project in Visual Studio.
  3. Open the project in the Editor.
  4. Add a new code class to the project derived from ActorComponent. Name the class TestActorComponent.
  5. Add a new code class to the project derived from Uobject. Name the class ARCharacterAttributes.
  6. Close the Editor.
  7. Add the following code to the ARCharacterAttributes.h file:
    USTRUCT(BlueprintType)
    struct FGAAttributeBase
    {
    	GENERATED_USTRUCT_BODY()
    
    public:
    	UPROPERTY()
    	FName AttributeName;
    
    	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Value")
    	float BaseValue;
    };
    
    /**
     * 
     */
    UCLASS(BlueprintType, Blueprintable, DefaultToInstanced, EditInlineNew)
    class TESTSTRUCTBUG1_API UARCharacterAttributes : public UObject
    {
    	GENERATED_BODY()
    	
    public:
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Resources")
    	FGAAttributeBase Health;
    };
    
  8. In the TestActorComponent.h file, add the following code:
    	UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Replicated)
    	class UARCharacterAttributes* DefaultAttributes;
    
  9. Add the following code to the TestActorComponent.cpp file:
    void UTestActorComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
    {
    	Super::GetLifetimeReplicatedProps(OutLifetimeProps);
    }
    
  10. Add the following code to the default character class header file:
    	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
    	class UTestActorComponent* TestComponent;
    
  11. Add the following include to the default character source file: #include "TestActorComponent.h"
  12. Add the following line of code to the constructor in the default character source file: TestComponent = CreateDefaultSubobject<UTestActorComponent>(TEXT("TestComponent"));
  13. Build the project in Visual Studio.
  14. Open the project in the Editor.
  15. Open the character Blueprint.
  16. Open the full Blueprint Editor if it did not open.
  17. Select the TestComponent component.
  18. In the Details panel, locate the Default Attributes property and make sure it is set to ARCharacter Attributes.
  19. Locate the Health property (Default Attributes -> Resources -> Health)

RESULT:
The value of the Health property cannot be edited.

EXPECTED:
The value of the Health property can be edited.

Have Comments or More Details?

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

19
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.6.14.7.24.84.12.44.22
CreatedMar 17, 2015
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue