Hi,
I know that question is old, but that might help someone.
_
To make an actor’s CPP component editable in blueprints in Unreal Engine 4:
- The key is to use “VisibleAnywhere”, and optionally “BlueprintReadOnly” in the UProperty meta so the editor displays them correctly. (IE: the movement component in the Character class)
- This way you can have both a default object configuration AND editor customization via blueprints.
- To add components at runtime, see this discussion.
_
Example code for a box component, in your actor class header:
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
UBoxComponent* MyBox;
In your actor class constructor:
MyBox = CreateDefaultSubobject<UBoxComponent>(TEXT("MyBox"));
MyBox->SetupAttachment(GetRootComponent());