The functionality I’m trying to achieve is similar to that of the Character Movement component in the Character class. If you create a blueprint class that inherits from Character, the resulting class will have an inherited Character Movement component which can have the default values adjusted if you click on it (changing max walk speed, etc).
Here’s what that looks like inside the editor:
Here’s my code (simplified):
BuffSystem.h:
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent), BlueprintType)
class PROJECTNAME_API UBuffSystem : public UActorComponent
{
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Buff Data")
UDataTable* BuffData;
}
PlayerCharacter.h:
UCLASS()
class PROJECTNAME_API APlayerCharacter : public ACharacter
{
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UBuffSystem* StatusEffectComponent;
}
PlayerCharacter.cpp
APlayerCharacter::APlayerCharacter()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
StatusEffectComponent = CreateDefaultSubobject<UBuffSystem>(TEXT("Buff System"));
}
Within Blueprint, I created a child class of APlayerCharacter called ThirdPersonCharacter. I have also manually added a UBuffSystem component to test with. For that one I can set the BuffTable variable (even when I had the variable as private). But there’s nothing showing when I click on the C++ inherited component.
This is what you can see when you select the manually added component:
This is what I see when selecting the c++ inherited class:
What macros or code needs to be added/adjusted to get the ability to edit the default values in editor?