Do Blueprints support tail recursion?

I want to ensure the pattern of calling the same event at the end of said event does not generate an infinite loop which may fill the stack.


You can use a Gate between two events with a condition to close the gate when a condition satisfies or when a key is pressed like an ‘esc’ key.


Sorry I think you dont know what Tail Recursion is. It is an implementation optimization that makes it safe to have in some cases infinite recursion without breaking the stack.

Calling an event at the end of the said event is going to cause recursive errors. BP’s do not support tail recursion. There is probably a better pattern to use than what you are suggesting.

Thank you for this answer! I will need to figure out a different method then. I have not yet hit any recursion limits yet but it is only looping once per second in a debug only feature. It should be safe for now

I know a couple of languages that implement tail recursion as a loop without any compiler optimizations. I thought that thats what you are asking for and I provided you an approximate implementation for the same.