How do I track when a Actor ceases to exist in a scene?

Hi everyone. There are several Actors in the scene that are destroyed during the game. How do I track when this happens? TActorIterator keeps track of the Actors, but how to use it to keep track of their deaths and to issue a message about this?

Check if actor ->IsPendingKill()
Or you can see if actor ->HasAnyFlags(RF_BeginDestroyed)

Thank you very much, but I’m new to ue4 and it’s not clear how to apply it. The idea is this: objects are created by the Spawner as a 2D array, destroyed, and if the iterator does not find them in the scene, a message appears.

for (TActorIterator<AObject> It(GetWorld()); It; ++It)
{

//if (Actors are not found)
{
// write a message
}

//but there is no message
//it is not clear what to compare with what

}

You are most likely approaching the issue wrong. Instead of checking every actor in the level, make it so that the actor notifies you before it’s destroyed. Check out AActor::EndPlay.

Yep. There’s almost no reason to ever use an iterator across the entire world, when you have complete control over the entire game code. Whatever spawns the items in question can keep track of their creation and destruction easily.