Developer Notes

Working as intended


When the actor is pulled from content browser to scene, a "ghost" object is created even if the actor is still being "held". Dragging the actor back and forth into the editor viewport will create multiple of the "ghosts". When the actor is released another object is created. When the actor in the viewport is deleted the destructor is called for each of the "ghost" objects that were created but not for the object that was actually deleted.
If multiple instances of a single class are placed in a level, deleting any one instance will call the class destructor once for each instance present in the scene. Any current instance will then not have the destructor called when removed (this includes using undo and deleting the original instance again).

Steps to Reproduce

1. Open UE4 Editor (any project)
2. Add code to project based on Actor (NewActor)
3. In the header file add the following to create a destructor:


4. In the source file add the following:

	UE_LOG(LogTemp, Warning, TEXT("Destructor Test"));

5. Compile
6. Add multiple copies (6) of NewActor(Instance) to the scene
7. Go to Window->Developer Tools->Output Logs to show output logs
8. Select one instance of NewActor and press the delete key

Output Logs show the "Destructor Test" text 6 times.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

Login to Vote

By Design
Affects Versions4.7.2
CreatedMar 11, 2015
ResolvedApr 23, 2015
UpdatedJul 14, 2021