Quantcast
Channel: General - Epic Developer Community Forums
Viewing all articles
Browse latest Browse all 9965

Allow Sparse Class Data on components created via C++

$
0
0

I have a habbit of creating components in my Actor’s constructor, so that the reference is obtained automatically, and also to ease the creation of blueprints.

However I have found that Sparse Class Data on components added in the constructor are not functioning properly. In particular in the Blueprint Editor, AttributesClass does not appear even though it is marked as EditDefaultsOnly (I repeat I am in the Blueprint Editor for my character, I am not looking at the character from the world hierarchy).

I think that this should be fixed no?

MyGameCharacter.cpp


AMyGameCharacter::AMyGameCharacter()

: Super()

{

...

Attributes = CreateDefaultSubobject<UMyGameAttributesComponent>(TEXT("MyGameAttributesComponent"));

}

MyGameAttributesComponent.h


USTRUCT(BlueprintType)

struct MyGame_API FMyGameAttributesComponentClassData

{

GENERATED_BODY()

public:

UPROPERTY(EditDefaultsOnly, Category = "MyGame", meta = (GetByRef))

TSubclassOf<UMyGameAttributeSet> AttributesClass;

};

UCLASS(BlueprintType, SparseClassDataTypes = MyGameAttributesComponentClassData, ClassGroup=MyGame, meta=(BlueprintSpawnableComponent))

class MyGame_API UMyGameAttributesComponent : public UMyGameActorComponent

{

GENERATED_BODY()

public:

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "MyGame")

UMyGameAttributeSet* Attributes = nullptr;

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 9965

Trending Articles