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 latent nodes to finish before looping in Blueprint?

I need to use a loop to load a bunch of meshes and place them next to eachother, using each bounding box as a basis to determine where to place the next one. Well, it's hard to explain, but long story short, I found out that I needed to use the "Load Asset" node. The problem is that "Load Asset" is a latent node. Already there I had to move my entire bp function out into the EventGraph and replace any local variables for it to work.

But the problem now is that the loop fires each cycle before waiting for the latent node to finish, so I can't use the previous meshes bounding box as that latent node hasn't finished loading in the mesh yet.

How can I prevent my loop from starting the next cycle before the previous one has reached the end?

I tried creating a recursive function, so it would call itself at the end, and use a loop counter variable and a max limit variable. It did work... but only for a very small number of iterations. Anything above that tiny number gave me a "Infinite Loop detected" error and shut it all down (although I'm 100% certain there was no infinite loop). I can't just increase the limit in the project settings either, as it is a store asset, meant to be included in others projects.

So, I'm desperate for any other ideas! Thanks in advance!

Product Version: UE 4.13
Tags:
more ▼

asked Apr 05 '17 at 05:38 PM in Blueprint Scripting

avatar image

Acriax
156 13 16 28

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

1 answer: sort voted first

I found a "solution" not long after posting the question.

It's so simple, I'm amazed it even worked...

Instead of a recursive event calling itself... just reroute the last exec pin to the beginning of the event.

Bam. No more infinite loop complaints!

more ▼

answered Apr 05 '17 at 06:40 PM

avatar image

Acriax
156 13 16 28

avatar image WixZ Jul 02 '17 at 04:31 PM

Hey I have the exact same problem in my project. I need to loop through an assetID array of material instances and only one asset is loaded properly because as you said, the first asset is the only that finishes loading when the forloop reaches the end of the array. How could I apply your fix to a for each loop that is dependant on the length of my array?

avatar image WixZ Jul 02 '17 at 04:44 PM

Nvm, I fixed it. What I used is a "Do N" node and well, ill just post a screenshots:

I basically just use the array index to define how many times the do N node needs to fire. Then as the OP posted I use the exit pin to retrigger the Do N until the array reaches it's max length. To reset it I always trigger reset right before the whole Do N node does it's thing.

alt text

do n.png (257.6 kB)
avatar image seaniepie Jan 07 '19 at 02:02 PM

Just to add for anyone else who finds this useful as I did, that for this to work properly in most cases you need to add an 'Int+Int' to add 1 after the Length node and an 'Int-Int' node before the Get node to subtract 1 from the count to get the correct indexed item.

I've personally used it to repeat through a series of actors disappearing off screen one by one waiting for the previous one to complete it's animation before triggering the next.

Cheers for the example WixZ

avatar image seaniepie Jan 07 '19 at 02:02 PM

Sorry, you don't need to add the +1 to the length, just the -1 before the get.

(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