UE4 Can a function run at the same time as Event Tick?

Hi all,

I have a quick question about the way UE4 works (specifically in blueprints). Do functions such as key presses and mouse clicks run while event tick is running? Let me give the following example. I have a variable set by default to 0. If I changed a variable at the start of the event tick function to 1 then changed it back to 0 at the end of event tick, and tried to get the variable on a key press, would there be any chance at all of it printing out 1?

Thank you very much and I hope this makes sense.

Event tick is firing every time a new frame is generated. Keypresses are fired when a key is pressed, and released for release event. If you are setting something on tick, and press a key to set a different value, yes. it will change, although once a new frame is created your tick will set it back.

Ok. Thanks - to break this down a little - can two functions in the same blueprint be running at the same time? Thanks for your help.

yea, so they will run when triggered. if you set two keybind events, and press at same time, they both trigger. functions are the same. you can bind them to play at same time aswell

Alright- last question - so if a function that is called, let’s say, by a key press, and it changes a variable then changes it back at the end of the function, is there any chance of event tick catching the value inbetween the changes? Any chance at all?

yes, tick will trigger at every frame, so assuming you function doesnt take more than a fame to trigger, it will see the variable. although, something to note is you want to use tick as little as possible… or I guess I mean for the things that REALLY need it. performing massive actions on tick will tank performance

Thanks for your help!