Actors spawned inside other Actors

Hey,

So I have an actor, my ship, which adds engines (Other actors) to itself inside PostInitializeComponents();
i.e

#define ADDENGINE(type, obj, loccomp, bp) \
	if (bp) { obj = SpawnBP<type>(GetWorld(), bp, loccomp->GetComponentLocation(), loccomp->GetComponentRotation()); \
	obj->ExternalHull = this->ExternalHull; \
	HideActorFromExternal(obj); \
	obj->SetActorLocation(loccomp->GetComponentLocation()); \
	Components.Add(obj); }

void AShip::PostInitializeComponents(){

	ADDENGINE(AShipEngine, TestEngine, SmallEngineLocation, SmallEngine);

	Super::PostInitializeComponents();
}
  • AShipEngine = Type
  • TestEngine = instance of AShipEngine*
  • SmallEngineLocation = A dummy
    USceneComponent that im manipulating
    inside my ship blueprint (editor)
  • SmallEngine =
    TSubClassOf , blueprint
    reference for the engine that im
    setting inside the editor.

this creates the following:

The engine blueprint, (The one in the middle with the button on it) has spawned correct, and is visible inside the ship blueprint( great! ).

Except it is not spawning on SmallEngineLocation’s position like i believe it should be, even when the game is running.

Would appreciate any help - Thanks :slight_smile:

PS:
Behaviour works as expected when i manipulate the position of the engine inside the engine blueprint itself.

Managed to fix this by setting the mesh component on the Engine actor to be the root component, then having the buttons parents of that. (previously they were all children of a dummy root component)