Don't destroy child actors
Hi, this seems like it should be an easy one but I am having trouble turning up a result for this in google.
At some point I want to destroy my base actor with pawn->Destroy();
I have already Detached some child actors from it and they are now sitting in the world. When I destroy my actor, the once child actors are destroyed too.
One last thing to note, these child actors were attached as ChildActorComponents in the editor.
How can I get my once child actors to stick around?
asked Mar 12 '17 at 01:45 AM in C++ Programming
How do you spawn the child actors? One thing I can imagine is happening is that you're spawning child actors with the to-be-destroyed actor as the outer/owner. Try using World instead. Let me know if it's the case and if so if my suggestion helped.
answered Mar 13 '17 at 12:43 PM
You can override the Destroyed() function of Actor (maybe BeginDestroy too, but not sure if that's too late) and just remove the child actors from the parent actor there to prevent them from being destroyed also. I think EndPlay should be called before the destroy sequence starts also, but that will only be called if your actor actually began play first, so maybe that's what you want. You have options though :)
answered Mar 13 '17 at 09:22 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here