Recursion problems - Does unreal use pass by value or pass by value-result?
I'm trying to make a function that calls itself four times at the end. In essence, I'm trying to implement the recursive subdivision algorithm for maze generation - I divide the map randomly into four, place some walls, and repeat on each of the four quadrants (until they get to unit sized at which point they don't recurse). So, my function RecursiveDivision ends with four separate calls, one after the other, to RecursiveDivision; each with slightly different inputs to tell the new function call where each quadrant starts.
But when the first new call happens, it updates the values of various variables in my original call, screwing up the inputs to the rest of my new calls. This surely isn't pass by value, like I though Unreal was meant to use, otherwise it couldn't touch the originals! It's presumably pass by value-result. I definitely have pass-by-reference unticked on the function inputs.
Any ideas, how to either fix this bug or work around it?
Ah, think I have it - had not noticed that my variables were all global to the blueprint rather than local to the function!
answered Jul 12 '15 at 10:34 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here