Arrays do not pass by reference into custom events

Hello,

The “pass by reference” check box is not working for arrays into custom events.

Steps to replicate

  1. Create a new blank level

  2. In the level blueprint create a variable named, “arrayNames”, which will be an array of the datatype “name”.

  3. create three entries for “arrayNames”, “A”, “B”, “C”.

  4. In the level blueprint, connect the beginPlay node to a foreach node and print out the contents of “arrayNames”.

  5. Create a custom event called, “test”.

  6. add a array of type “name” as a parameter to the “test” custom event. Name the parameter, “nameParam”.

  7. add a “clear” node to the custom event so it clears the array when the event is called

  8. Also, make sure to make “nameParam” pass by reference.

  9. connect the end of the for loop to call the “test” event custom event (after the loop reaches completed).

  10. 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

Hello James,

After doing a bit of digging I was able to find that this is a known issue. I have provided a link to the public tracker. Please feel free to use the link provided for future updates. If you need further assistance please let me know and I will be happy to help.

Link: Unreal Engine Issues and Bug Tracker (UE-37202)

Make it a great day

Thanks for confirming this for me Rudy.

If any body else runs into this problem, you can fix it now by converting your custom event into a function. The “pass by reference” button on functions is working properly for arrays. If you just select your entire custom event graph and right-click, there is a menu option to convert to function.

thanks,

James