# How can I create a Sub-Object Property in my custom UActorComponent class, to access from Blueprint?

**URL:** <https://forums.unrealengine.com/t/how-can-i-create-a-sub-object-property-in-my-custom-uactorcomponent-class-to-access-from-blueprint/334888>\
**Category:** UI\
**Tags:** hud-blueprint, hud, unreal-engine, question\
**Created:** [October 10, 2015, 6:05pm UTC](https://forums.unrealengine.com/t/how-can-i-create-a-sub-object-property-in-my-custom-uactorcomponent-class-to-access-from-blueprint/334888 "2015-10-10T18:05:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Korant](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Korant](https://forums.unrealengine.com/u/Korant)\
**Post date:** [October 10, 2015, 6:05pm UTC](https://forums.unrealengine.com/t/how-can-i-create-a-sub-object-property-in-my-custom-uactorcomponent-class-to-access-from-blueprint/334888/1 "2015-10-10T18:05:29Z")

</div>

Hi everyone,

I have a class StatsController, where I’m storing my character’s \_health:

```
class UStatsController : public UActorComponent
{
	GENERATED_BODY()

public:
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = HUD)
	int32 _health;
};

```

In my HUD EventGraph, I’m doing the following:

```
Event Contstruct -> 
Get Player Character -> Cast To MyACharacter

```

In my HUD HealthProgressBar, I’m able to see the Stats Controller, but there are no available Sub-Object Properties to bind to.

How can I enable my \_health (or even a float \_percentHealth) to be a bind point in the HUD blueprint?

---

<div class="post-metadata">

**Author:** ![DanaFo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanaFo](https://forums.unrealengine.com/u/DanaFo)\
**Post date:** [February 3, 2016, 7:28am UTC](https://forums.unrealengine.com/t/how-can-i-create-a-sub-object-property-in-my-custom-uactorcomponent-class-to-access-from-blueprint/334888/2 "2016-02-03T07:28:01Z")

</div>

You need to make the member variable visible and editable in blueprints, here are the parameters explained:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

most commonly though:  
(inside your component .h)

```
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = whateveryouwant)
membervariabletype membervariablename;

```

in the object constructor, initialize it:

```
APlayerPawn:APlayerPawn()
{
membervariablename = blah;
}

```

Then in the HUD, drag off the cast of the AMyCharacter and search for the member variable name.
