► React to Editor Destroying/Deleting an Actor
my Actor is spawning some other actors using GetWorld()->SpawnActor. I store them inside an Array and I can already destroy all of them if needed. The problem is that it is possible to delete the main Actor using the editor without destroying the spawned ones.
So I thought that I need to override Destroy() or K2_DestroyActor() and add a call to my custom destroy function there. That does work ingame, but not in the editor.
Which function do I have to override to do that?
// Edit: Please ignore the explanation in this question. Look at the newer ones down there in the comments.
Just to make sure I understand what you're trying to do, when you delete the main actor in the editor you want its destructor to delete the other actors it spawned? While it seems this is related to the other post you linked, would you be able to add a check to the spawned actors for the main actor(pseudo code):
This way each spawned actor would destroy itself if the main actor doesn't exists.
answered Mar 12 '15 at 03:51 PM
Have you tried overriding AActor::BeginDestroy?
answered Mar 08 '15 at 08:04 PM
I'm trying to create a procedurally generated level, and the actor in question is responsible for previewing it Pre-PIE.
So I just added a bool uproperty now that allows me to destroy all spawned actors (checking it in OnConstruction) and I use that whenever I want to delete the main actor.
I don't think you have to track the behaviour described above as a bug - it's rather a little limitation. And I guess I'm also the only one who tries to do something like this - so rewriting that part of the editor is not necessary.
And by the way: Thank you for your patience, Doug. It seems like Epic really wants to support the community - and I really appreciate that! I guess that's it for now. Thank you and have a great day!
Follow this question
Once you sign in you will be able to subscribe for any updates here