# Problems spawning sounds attatched to a component.

**URL:** <https://forums.unrealengine.com/t/problems-spawning-sounds-attatched-to-a-component/2592331>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [July 5, 2025, 9:07pm UTC](https://forums.unrealengine.com/t/problems-spawning-sounds-attatched-to-a-component/2592331 "2025-07-05T21:07:07Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![RVillani](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rvillani/32/1194572_2.png) [@RVillani](https://forums.unrealengine.com/u/RVillani)\
**Post date:** [October 16, 2025, 8:05pm UTC](https://forums.unrealengine.com/t/problems-spawning-sounds-attatched-to-a-component/2592331/3 "2025-10-16T20:05:33Z")

</div>

You can use `UPROPERTY`, but make it `Transient` so it can’t be _loaded_ as `nullptr` when the engine serializes it from some BP class with broken references.

You likely don’t need default values from Blueprints to be kept on the nested component, as Blueprints can’t even access those from the components panel. So the workaround here is to not allow the engine to replace that `UPROPERTY` at all by adding the `Transient` tag to it: `UPROPERTY(Transient)`. Again, the actual fix is to not use nested components.

* * *

The real issue here, though, is just having nested components.

Notice the `Default` on the parent component object name (if you’re looking at the values in memory during a crash or break point). That’s the `ClassDefaultObject` (CDO) instance of the Blueprint archetype for the component being instanced. This problem usually arises from nested components, where `CreateDefaultSubobject` is called from inside another component.

### Avoid nested components like the plague

First of all, **avoid nested components**. When using the parent component directly in Blueprint classes, the `SimpleConstructionScript` (SCS) systems are unaware of the nested component. A lot of important functionality related to serialization, parenting and networking is missed on the nested component when instancing it from its Blueprint template (archetype).

On serialization and cooking, the nested component is treated as a generic sub-object, and its properties are copied straight from its archetype in `FObjectInitializer::InitProperties`, without awareness of component hierarchy, registration order and whatnot. That happens just after the parent component’s constructor. Non-transient `UPROPERTY` pointers on the nested component, like `AttachParent`, get overridden, copied straight from the archetype, resulting on the instanced nested component pointing to the other archetype components, instead of its sibling instances.

### If one insists on having nested components

**T** here’s a workaround for the `AttachParent` issue specifically. Set the nested component’s `AttachParent` after the parent component’s constructor, before `AttachToParent()` is called by the nested component’s `OnRegister()`.

`PostInitProperties()` is called right after properties are copied on the parent component’s sub-objects, but before any component registration, when they get actually attached to the parent from `SetupAttachment()`.

```auto
void UParentComponent::PostInitProperties()
{
  Super::PostInitProperties();
  NestedComponent->SetupAttachment(this);
}

```

I saw some solutions to this with `OnRegister()`. Trying to fix this issue in the parent’s `OnRegister()` works only sometimes. `OnRegister()` order is not guaranteed, because it’s called by the owner Actor after all components have been instantiated. The nested component may get registered before the parent, setting up its attachment to the archetype instances before the parent component has a chance to fix the nested component’s `AttachParent`.

### An actual long-term solution

These are just some of the issues one might have to fix with nested components. Those will keep cropping up and the actual fix is to not have them at all. Components should be created directly by Actors and be stored on `UPROPERTY` fields of the Actor class. There’s SCS logic regarding those properties too.

[Here](https://kisspread.github.io/notes/Basic/painful_ue.html#nesting-actor-components-isnt-exactly-straightforward)’s a great small text on doing that while keeping most of the nested component related code within the parent component. Shoutout to @zero.soul for it.

---

_[View the full topic](https://forums.unrealengine.com/t/problems-spawning-sounds-attatched-to-a-component/2592331)._
