Actor OnDeconstruction?

I’m using the virtual function OnConstruction to rebuild and create components based on properties users can change, just like you can with blueprints (ConstructionScript). It is fired off every time a property is changed so you can rebuild if necessary.

I would like to know when the user deletes the actor from the editor though. Is there an event or virtual override I can use when this happens to process some code prior to it being removed? I looked into BeginDestroy but that is not called. The process of destroying an object only takes place when you go through the BeginPlay/EndPlay but not while working in the editor.

Is this possible? I can’t seem to find the answer looking through the source.


Destroyed() should be called in the Editor case as well. Ideally at some point in the future Destroyed would be for editor-only and EndPlay would be for in-game only, but because Destroyed existed long before EndPlay they are both called in the game case as well.

Beautiful! Thanks!