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.
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; };
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Replicated)
class UARCharacterAttributes* DefaultAttributes;
void UTestActorComponent::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
}
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) class UTestActorComponent* TestComponent;
RESULT:
The value of the Health property cannot be edited.
EXPECTED:
The value of the Health property can be edited.
Head over to the existing Questions & Answers thread and let us know what's up.