I have a function that calls itself a few times over and over to get a certain result. Everything in it works, but sometimes it goes into too many functions (of itself) and causes a frame rate spike. So, I want to pause all the current functions for a frame, and then resume.
Now I thought that if I use sleep() at the beginning of the function it would work but its not working. I have a counter which checks how many times the function has been called, my.cur_depth, and I use this to pause it: if(my.cur_depth % 20==0){sleep(1);} But its not working the same as when it is without the above. Anyone have any ideas of what I could do?
God DID give us a manual on how to change this world...
Well, that's of course as returns do not return anything at all with a wait in front of them. Pass an extra argument as a vector and give the value back with the vector.
Always learn from history, to be sure you make the same mistakes again...