When calling Events in Blueprints recursive, the parameter of the Event is wrong after returning the recursion. This causes very strange behaviour in my project where the recursion is called indirectly through other blueprints.
I could reproduce the behaviour with the following Blueprint.
After looking over your post it appears that you are reporting the print string being called more than once. If this is not the case, could you explain your issue further with a more concise description of how the actual result is at an inverse to the expected result?
This appears to be working as intended. The print string in this case will be called more than once. This is because “Name” is set to “Test2” on Then 0, this means that by the time Then 1 is called it has already been changed to “Test2”. That is call number one. After this the second call of the custom event “Test Recursive” needs to be resolved. This is when the print string is called a second time.
Flow:
Begin play > Call Test Recursive (sets Name to “Test1”) >
Firing Test Recursive > Sequence > Then 0 > Branch (True) > Call Test Recursive (sets Name to “Test2”) > Then 1 > Branch (True) > Print String >
Firing Test Recursive > Sequence > Then 0 > Branch (False) > Then 1 > Branch (True) > Print String
This is exactly what I mean. Maybe this works as intended but not as expected.
The Name type is a Value Type that is passed as Function Parameter to the Event. So the second recursive call shouldn’t change the Parameter of the first recursive call because this value is a level below in the Stack.
Even if the Parameter is passed by reference the referenced value of the first recursive call is never changed so the parameter of the second recursive call is a new reference.
In any other programming language this example will call “Print String” only once.
After going back through and speaking with some developers I was able to find that this appears to in fact be an issue. I have written up a report ( UE-25551) and I have submitted it to the developers for further consideration. I will provide updates with any pertinent information as it becomes available.