# Expose a pointer to UActorComponent via UProperty?

**URL:** <https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553>\
**Category:** Editor Scripting\
**Tags:** UProperty, reference, unreal-engine, Components, Blueprint, CPP, question\
**Created:** [August 22, 2017, 8:12pm UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553 "2017-08-22T20:12:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![plockhart](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plockhart](https://forums.unrealengine.com/u/plockhart)\
**Post date:** [August 22, 2017, 8:12pm UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553/1 "2017-08-22T20:12:24Z")

</div>

Hi,

I have a C++ component class:

> 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.

I have a UProperty defined like this:

> UPROPERTY(EditAnywhere,  
> BlueprintReadWrite, Category =  
> “Weapon”) UWeaponComponent\*  
> WeaponComponent;

But it does not show up in the details panel. What am I missing? Thanks in advance.

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [August 27, 2017, 11:55pm UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553/2 "2017-08-27T23:55:28Z")

</div>

Are you sure it isn’t in the details panel under `Weapon`, you can search for it. If not, let us know.

---

<div class="post-metadata">

**Author:** ![plockhart](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plockhart](https://forums.unrealengine.com/u/plockhart)\
**Post date:** [August 28, 2017, 6:45pm UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553/3 "2017-08-28T18:45:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [August 29, 2017, 12:57am UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553/4 "2017-08-29T00:57:53Z")

</div>

I don’t think you can do that.

Instead you could create an enum of components that you could choose from, and select the component.

This might be worthy of a Bug Report / Feature Request.

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [August 29, 2017, 12:58am UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553/5 "2017-08-29T00:58:20Z")

</div>

Ah, I understand now.

---

<div class="post-metadata">

**Author:** ![plockhart](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@plockhart](https://forums.unrealengine.com/u/plockhart)\
**Post date:** [August 29, 2017, 9:38pm UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553/6 "2017-08-29T21:38:06Z")

</div>

Ok, thanks 🙂

---

<div class="post-metadata">

**Author:** ![Radium\_Polonium](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Radium\_Polonium](https://forums.unrealengine.com/u/Radium_Polonium)\
**Post date:** [April 18, 2024, 9:42pm UTC](https://forums.unrealengine.com/t/expose-a-pointer-to-uactorcomponent-via-uproperty/402553/7 "2024-04-18T21:42:41Z")

</div>

I have a similar problem.  
I am trying to expose UActorComponent pointer and can’t make it show in details panel.

```auto
    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?
