Get all Idle Characters on Level/Map

Hi everyone!

I am trying to implement a system in my RTS demo that detects all idle characters on the map and feeds this back to the HUD. I know how to do the HUD part and how to reference an idle unit using the get velocity node through the movement component, but I am just trying to figure out an optimal way of doing this without putting a cast; or a “Get Actors of All Class” node on a looping function or Event Tick.

What is the cleanest way of doing this? - ideally it would need to be checking at all times so I have no doubt that there will need to be some kind of looping function… but I am just curious if anyone knows a better way (If it exists)

Just to give an example of what I am trying to achieve - if you have played any of the Age of Empires games, you will know that if a villager is standing still and does nothing at any point during the game; they will be marked as Idle - this will then feed back to the HUD to show how many idle villagers you have on the map.

Dont event tick all actors of class. Why not notify the hud from each villager instead of searching for them? If the villagers enter a state in the AI as “idle” set a bool in the actor using a timer. signal that to the hud, and add them to an array in the hud with their respective world location. and in the hud you can do another timer.