# How do I setup nested components in c++

**URL:** <https://forums.unrealengine.com/t/how-do-i-setup-nested-components-in-c/427752>\
**Category:** Blueprint\
**Tags:** child-actor-componen, constructors, unreal-engine, CPP, Blueprint, question\
**Created:** [June 20, 2018, 1:39am UTC](https://forums.unrealengine.com/t/how-do-i-setup-nested-components-in-c/427752 "2018-06-20T01:39:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fuzzmunch](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fuzzmunch](https://forums.unrealengine.com/u/Fuzzmunch)\
**Post date:** [June 20, 2018, 1:39am UTC](https://forums.unrealengine.com/t/how-do-i-setup-nested-components-in-c/427752/1 "2018-06-20T01:39:39Z")

</div>

So what I’m trying to setup is basically a USceneComponent that I can add with the ‘add component’ button in blueprints that comes with a UStaticMeshComponent already attached. Not sure that this is possible but it seems like it should be.

Here’s the relevant part of the class:

```
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent), ClassGroup = CustomGroup)
class UCustomComponent : public USceneComponent
{
	GENERATED_BODY()
	
public:
	UCustomComponent(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());

	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Custom")
	UStaticMeshComponent* CustomMesh;
}

```

And the constructor:

```
UCustomComponent::UCustomComponent(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
	CustomMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Custom Mesh"));
	if (CustomMesh)
	{
		CustomMesh->SetupAttachment(this);
	}
}

```

When I add UCustomComponent to a blueprint it doesn’t show anything nested. In the details panel I can see properties of both components but I can’t tell which is which 'cause they aren’t categorized. Also, it seems like they’re using the same transform as changing one affects the other.

 ![244856-help.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/8/0d8f73ac11425d82611f291074577161237ad366.png)

---

<div class="post-metadata">

**Author:** ![Titirez](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/titirez/32/1194668_2.png) [@Titirez](https://forums.unrealengine.com/u/Titirez)\
**Post date:** [August 28, 2019, 3:01pm UTC](https://forums.unrealengine.com/t/how-do-i-setup-nested-components-in-c/427752/2 "2019-08-28T15:01:32Z")

</div>

Same problem, did you find a solution ?
