x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: Not Selected
Tags:
more ▼

asked Mar 11 '18 at 06:18 PM in Everything Else

avatar image

MarsMiner
52 6 11 22

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Mar 11 '18 at 10:05 PM

avatar image

ElegantSquid
42 1 3 6

avatar image MarsMiner Mar 16 '18 at 04:57 PM

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.

avatar image ElegantSquid Mar 16 '18 at 07:47 PM

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

avatar image MarsMiner Mar 17 '18 at 07:18 AM

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?

avatar image ElegantSquid Mar 17 '18 at 04:48 PM

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

avatar image MarsMiner Mar 17 '18 at 04:55 PM

Thanks for your help!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question