Hi! I am having a problem trying to instantiate a UObject in a Component.
My UObject .h:
UCLASS(DefaultToInstanced, BlueprintType)
class TOPDOWN_API UAttributes : public UObject
{
GENERATED_BODY()
private:
UPROPERTY(EditAnywhere, Category = "Base Attributes", meta = (AllowPrivateAccess = "true", ClampMin = 1))
int Strength;
}
I declare the UObject in my component .h
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UAttributes * Attributes;
And I instantiate the UObject in the .cpp:
UStateComponent::UStateComponent()
{
Attributes = CreateDefaultSubobject<UAttributes>(TEXT("Attributes"));
}
Then I declare the component in the Character:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
class UStateComponent* StateComponent;
And I instantiate the component:
StateComponent = CreateDefaultSubobject<UStateComponent>(TEXT("StateComponent"));
The problem is that it isn’t showing the properties of the UObject in the property window.
But the strange thing is that if I create the Component from the editor then it shows the properties.
What am I missing?