How to fire an event once every time a multi sphere trace hits a new actor, and another event when it stops hitting an object?

A couple of alternatives:

  1. Create an actor component with a timer on begin play. When trace hits, check for a MyTraceHitComponent. If not found then add it and a reference of the actor to the array, if found then reset the timer. When the timer runs out remove the component. The components life can help manage the the reference in the trace actor. An actor tag could also be added with the component to check against.
  2. For a lot of hits: Add the hit actors to a map<reference, float> where the float is the life of the actor in the map. On every trace check if the hit actor is in the map; if found reset the float. Loop the keys to decrement the value by elapsed time from last frame. If float <= 0.0, remove from map.

For both the idea is to manage the time without having to search an array multiple times.