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"

Wait for input without event tick? While loop causing crash?

The functionality I'm trying to include involves the player holding the reload button and then waiting for one of two inputs. With the reload button held down the player can:

  1. release the reload button triggering event A (which I've got working)

  2. press the fire button triggering event B (which I'm having trouble with)

I'm trying to avoid utilizing Event Tick from this solution so I implemented a while loop which sets a Boolean control flag on the loop to stop executing. However when I run to this bit of code, I get an "Infinite loop detected" in my log which causes the playback to crash. Now the infinite loop would be correct if the player doesn't provide one of those two inputs as I don't want anything to happen unless they choose one of the options listed above.

So am I programming this wrong or does Unreal not see that it can break out of the while loop eventually? alt text

Waiting for Input by default is set to True. What can I do to remedy this?

Product Version: UE 4.14
Tags:
waitforinput.png (110.6 kB)
more ▼

asked Dec 21 '16 at 12:13 AM in Blueprint Scripting

avatar image

Dieinthedark93
27 3 7 11

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

1 answer: sort voted first

Do you have to rule out using tick entirely? You could use a gate to prevent the tick actually doing anything while the reload key isn't pressed. I.e. Open the gate on pressed and close it on release.

Alternatively you could use a timeline of say, one second long with no outputs to loop over the nodes until it's released. So On Pressed plugs into Play and On Released plugs into stop. Then plug Update into your Branch.

more ▼

answered Dec 21 '16 at 12:26 AM

avatar image

Natcracker
93 4 5 9

avatar image Dieinthedark93 Dec 21 '16 at 06:32 AM

Is a timeline more efficient? I'll go ahead and accept your answer since it does in fact work, I'm just trying to think about efficiency here more than anything. A single comparison with the Event Tick isn't a huge deal I assume but it is still happening for the entire level

avatar image Natcracker Dec 21 '16 at 05:31 PM

Timelines more efficient in the way that it doesn't take priority, it doesn't need to fire every single frame. I'm by no means an expert on the matter but I'm sure if there's something elswhere that needs the time the Timeline will just skip a tick.

avatar image Natcracker Dec 21 '16 at 05:33 PM

Also, I think the tick is being fired every frame anyway, with or without the node. It just doesn't do anything until you plug it into something.

(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