UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class DemoProject_API
UWeaponComponent : public
UActorComponent { GENERATED_BODY() }
And in another Actor class, I would like to expose a reference to it. What I am trying to do is have a Rifle blueprint, which has a property exposed in the Details panel, where the user can drag and drop a WeaponComponent into the field. The weapon component would exist in the Components tab as a child of the RootComponent of Rifle.
I know I could programmaticly search through the children, but I would quite like as an exercise to let someone drag and drop the component reference similar to how you might hook up a Monobehaviour reference in Unity. I would then want to actor upon that pointer in my gameplay code.
Thanks for the reply, but I’m afraid not. I can only get it to appear if it is declared as a UObject, but it will only let me assign things from the Content Browser and not the Components tab. If I keep the declaration of UWeaponComponent then I can assign the variable myself via Blueprints via the Construction Script, but that’s not what I would like to achieve.
I have a similar problem.
I am trying to expose UActorComponent pointer and can’t make it show in details panel.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Devices")
class UActorComponent* ButtonActorComponent;
As plockhart mentioned I can expose it as an UObject, but then I can only set it from content drawer, not from components added to this actor.
Did anyone find solution to that problem?