C++ Destructor & BeginDestroy - Run only _once_?!

Hello,

having a destructor (AMyActor::~AMyActor) and deleting an instance of the Actor in the editor calls the destructor. However, when you press Ctrl+Z (Undo), and then delete it again, the destructor is NOT called.

Steps to reproduce:

  • Create new Actor in CPP
  • Create Destructor (with UE_LOG for example)
  • Compile and place Actor into level
  • Delete it, should call destructor
  • Undo
  • Delete again, destructor is ignored

// Edit: I just noticed that even that call that goes through once is unable to do most of the stuff I want to do. (For example: Destroy other actors in the level).
So I guess there is some other function that gets called by the engine when destroying it in the editor… Right?

// Edit2: Seems like BeginDestroy() shares this problem with the destructor. It is also only called once.

Hey holzlag0r-

After some testing it seems that the destructor for the class is called once for each instance of the class in the level (multiple instances will call the destructor multiple times when the first one is deleted). This bug has been reported and is being tracked internally as UE-11680 for investigation.

Cheers

Alright, thank you!