Download

attaching actor to actor

hi,

I want to spawn new actor and attach/parent it to another one. I have few options here, and I am very confused which one I should use and whats the difference between them.

  1. SpawnActor from Class and AttachActorToComponent

d7ba7ec4acdad115970005dc470a3a98bfa94ff1.jpeg

  1. SpawnActor from Class and AttachActorToActor

1349a82787ec08c2f49fa0c8b07d376775a10b07.jpeg

  1. AddChildActorComponent

0d906c9beb0a1b88d992bd5a06f3952de9981843.jpeg

Is there any fundamental difference between those methods ?

Once I do any of them, I try to get children and destroy them. Well, I try but no luck :slight_smile: I call this from the same actor as I spawn them.
I tried another way of destroying them, to make a function in spawned actor that destroys self, but. I cannot cast from GetChildrenComponents to parent class of spawned actor to call this function. It only allows me to cast to components, not actors.
Basically attached actor became a component, I dont quite get this part.

04958e1e129c05e2c61dbcdf25ce0172fcb34203.jpeg

Help in any way please!

thx

From that Array Element node you can use Get Owner node to get the Actor class that owns that component. You can then Cast that Get Owner node to your specific actor class.

&stc=1

thanks, thats exactly what I needed.

cheers!