It’s possible that it indeed reaches 250 calls, but how to bypass this limit? For ‘infinite loop’ error we can set ‘Max Loop Iteration Count’ in Project Settings, but I don’t see anything for max recursion calls. Any clues?
I would really like to get a clue about it as well. Since I’m having a function needing to be called legitimately about a 1600 times (it’s not for real-time purpose, but rendering.)
For some reason. Having a loop in a loop in my tick event that calls a couple of functions a couple thousands of times is fine. Could you try to move this part of your script from your construction script to the Begin Play event?
You may also want to try to do the things you do in your function outside of it (like taking it out and putting it in the graph rather than having a function)
I did work out a work/around by instead of using a recursive function, I use a for loop. Start index 0, and last index a variable. During the loop, I query if this is the last iteration, and if not, I add 1 to the variable, so that it keeps increasing by 1 until the query is met.
Engine protect the BP vm with recurse limit to prevent the Editor process to be terminated accidentally. With desktop platform, it’s set to 250 with the recursion limit. If you got a source engine version, you can enlarge it as your own responsibility while you know what it may happen. Check ScriptCore.cpp and change RECURSE_LIMIT to a acceptable value your recursive function may achieve.
One way around this without an engine modification is to duplicate your recursive function, if original function is recursive1 then name duplicate e.g. recursive2 now from recursive1 call recursive2 and from recursive2 call recursive1.
No more warnings generated (and no more performance hit from generating that warning message).