BeginDestroy is called when the object is actually garbage collected, which may be a long time after it’s removed from the world. If you’re only dealing with actors, you could try overriding AActor::Destroyed instead, which is called before it is removed from the world.
Whenever I drag & drop an actor from content browser into the viewport 2 of them are spawned, one when the mouse enters the viewport (from SLevelViewport::OnDragEnter) and another one when I release the mouse button (from SLevelViewport::OnDrop). They’re different objects, since this
points to different places. The problem is that I use PostActorCreated to “register” them to my level script actor and BeginDestroy to “unregister” them, however the 2nd Actor created doesn’t call BeginDestroy, even when the other one is deleted, it stays in the memory until I exit the editor.
Is this intended behaviour and can I somehow check which one of those actors is the “fake” one?
The problem isn’t with catching the destroy callback, but with the fact that 2 actors are spawned.