Widget Blueprint Update Frequency

Hello!
I was wondering what the frequency of updates of a variable inside a HUD Widget Blueprint. I thought to put a “Get Actors Of Class” inside a text binding graph, no I know it is usually bad, but can you help understand how bad? Tick bad? Is there a way to control or trigger an update? The idea is to display how many targets are left in a level.
Hopefully, the problem description is clear enough.

Thank you in advance!

I went for coal and I struck gold. A super answer from Everynone! You deserve all the good karma the universe sends your way.
I went with the usual UI binding before your answer, but I felt that even that would be not the most efficient way. I should always check the documentation first! I will do what you suggest.
Thank you!

Hello! I was wondering what the
frequency of updates of a variable
inside a HUD Widget Blueprint. I
thought to put a “Get Actors Of Class”
inside a text binding graph,

This will execute every frame. And if you read the tooltip of “Get All Actors Of Class”, it will specifically tell you to not execute it every frame. It’s fine if you’re messing around. It’s not if it’s for something more than an experiment / testing things out.

With UI (and most other things) you want to adopt an [Event Based][1] approach:

  • Enemy Dies → Add +1 to the count → Update Widget (once rather than 60 times per second…)

Do look into Event Dispatchers and Interfaces - these will allow you to facilitate this.

Is there a way to control or trigger
an update?

Actors can choose their Tick interval:

But that solution serves another purpose. You should choose when to update things rather than have it dictated by the frame / tick rate. Again, dispatcher callbacks work well for this. See below for an example.


  • in the player:

  • we create a widget
  • get all existing enemies and count them
  • register their Destroy events
  • here, the enemies call Destroy (self) when the player touches them
  • this will trigger the Custom Event in the Player BP which counts down and updates the widget
  • this event will fire only when an enemy gets Destroyed

Image from Gyazo

The widget has just a text block and no script whatsoever. Rather than relying on a widget pulling the data out of the entities, we push it in instead, and only when it’s needed.