Event driven or every tick?

@ben, in your video you explain that instead of using a tick function, you bind a new function “Get Crosshair Color and Opacity”.
The reason: it should be event driven and not run every tick.

Well, this function is called every tick and it is requesting the state from the aiming component every single frame. (to test, just place a print string node before return node)

Any other way to build this? (for learning purpose)

Pretty sure Ben meant doing the calculation every tick. Events drive the state but the state defines the colour.

Edit: Another way you could possibly do this is to keep a reference to the UI Widget when you create it for the player and then create a delegate in which to update it.

1 Like

Yeah, I mean we are not concerned about when this is done. We let go of the execution flow, and leave it to the engine. It is clean because it’s clear when we look at the colour of the crosshair what’s in control.

We’re about to dive into execution flow in more detail over the next three videos about debugging.

Thanks DanM and ben for clarification. I was thinking about a delegation method as well. But all this might be a case of premature optimization, so I am gladly waiting for new videos :slight_smile:

They’re coming, we’re having mass architecture debates here… won’t be long

Privacy & Terms