I am trying to do heavy math in BP and get the “infinite loop detected” error. Other threads recommend moving the math to C++ Code to make it possible and enhance performance.
My question: How would I do that?
Can I create a Function in C++, pass the value that I need into it and let it output the corresponding value to my BP so that I can use it further on?
Will this setup really boost performance and allow for heavy math? Sounds too good to be ture for me, haha
c++ is always going to faster for math and tight loops by quite a bit - when you get to the point of triggering BP infinite loop timeouts, it’s time to either change the algorithm or dive into c++…
BP is a limited layer built on top of c++ which in the end has to translate back into c++ and generates a ton of extra data as well. But your infinite loop problem points at a problem with the code, no matter if it is BP or c++. It is highly unlikely any blueprint would hit the calculation limit triggering a infinite loop warning (limit set in project settings), so you should triple check the bp code first.
“To change the algorithm”
Yeah, but I am really not smart enough to figure out a mathematical relation for this optimization problem
@Roy_Wierer.Seda145 “Tripe check your code first”
I did that many times. All I am doing is trying to create the cartesian product of three arrays with 22 elements each (22^3 = 10,648 iterations) and I am sure that my setup is correct. Still I get the timeout issue.
Buddy here had the same issue (https://www.reddit.com/r/unrealengine/comments/6z1pi2/infinite_loop_detected/) and they said it is due to the nested “for each loops” which I also have.