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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

can i change the max loop iteration count at runtime?

hi everyone

maybe someone know if I can, and how to change the max loop iteration count at runtime using blueprints? if not can it be done by c++ , or you can only change it in the project setting in the editor?

thanks in advance


Product Version: UE 4.21
more ▼

asked Dec 11 '18 at 02:50 PM in Blueprint Scripting

avatar image

leo bar
9 2 7

avatar image Tuerer Dec 11 '18 at 03:06 PM

You can set two Int variables, set the first one to 0, and the second to whatever number you need; inrement the first Int every time a loop executes, and check its value against the second before the next iteration. And you can change the second Int whenever you want, at runtime included.
If you mean the ForLoop, it's the same, feed the Int to the Last Index, and you can change that at will.

avatar image leo bar Dec 11 '18 at 03:50 PM

thanks tuerer

thanks for your help, and I am sure it will work, but I need some way to manipulate the max loop iteration count because I have a complex code with a loot of forloop and that's mean I will have to change the all code. I will do it but I thought maybe there is a simple way to change it at runtime.

again thanks for your help


avatar image Tuerer Dec 11 '18 at 04:03 PM

Frankly, I don't think it's possible. For Loop is a standard macro that always takes in those input values.
Are you saying that you use lots of For Loops with manually entered values? Can you describe at least one example where you need to use the For Loop and change the number of iterations back at forth?

avatar image leo bar Dec 11 '18 at 04:23 PM

hi tuerer

I think I have not explained myself well enough, I'll try to give you a little more details.

my project start with a creation of a grid(consist of locations, edges, ect...), to generate a large grid I encounter an error, in order to fix it I need to go to the project settings and change the max loop iteration count from 1,000,000(the engine Default) to much Higher values.

but I need the Higher values only to be a the beginning (when I generate the grid), after that I want to go back to the engine Default of 1,000,000.

so that way i have looked for a way to change the max loop iteration count at runtime. hope it make sense

thanks again


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

0 answers: sort voted first
Be the first one to answer this question
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