Hello,
The “pass by reference” check box is not working for arrays into custom events.
Steps to replicate
-
Create a new blank level
-
In the level blueprint create a variable named, “arrayNames”, which will be an array of the datatype “name”.
-
create three entries for “arrayNames”, “A”, “B”, “C”.
-
In the level blueprint, connect the beginPlay node to a foreach node and print out the contents of “arrayNames”.
-
Create a custom event called, “test”.
-
add a array of type “name” as a parameter to the “test” custom event. Name the parameter, “nameParam”.
-
add a “clear” node to the custom event so it clears the array when the event is called
-
Also, make sure to make “nameParam” pass by reference.
-
connect the end of the for loop to call the “test” event custom event (after the loop reaches completed).
-
connect the end of the “test” custom event to print out the contents of the array.
What you will get with this setup is the output of the following:
LogBlueprintUserMessages: [Untitled_C_3] A
LogBlueprintUserMessages: [Untitled_C_3] B
LogBlueprintUserMessages: [Untitled_C_3] C
LogBlueprintUserMessages: [Untitled_C_3] A
LogBlueprintUserMessages: [Untitled_C_3] B
LogBlueprintUserMessages: [Untitled_C_3] C
When what should be happening is:
LogBlueprintUserMessages: [Untitled_C_3] A
LogBlueprintUserMessages: [Untitled_C_3] B
LogBlueprintUserMessages: [Untitled_C_3] C
If we have a check box for pass by reference, then what happens in the custom event should be reflected in the variables after the event returns to normal execution. To me this seems like a major bug that should be fixed soon. Its basically causing me to program without functions (custom events).
HELP!!!
James