Description

When an array is passed into a BP custom event, the array's data is passed to the event rather than a pointer to the array itself. This means edits made directly from the event node's input pin (such as adding an element to the array) do not affect the original array. Checking the box for "Pass by Reference" does not affect this behavior. This is inconsistent with how arrays are read in C++ and BP functions where editing the array affects the array everywhere.

Workaround:
Using a function instead of custom event allows edits using the input pin to affect the original array.

Steps to Reproduce
  1. Open UE4 Editor
  2. Create blueprint based on actor (ActorBP)
  3. Add boolean array variable with 3 default elements
  4. Setup Event Graph as shown in attached screenshot
  5. Compile blueprint
  6. PIE

Result:
The length of the array is first printed in red and shows three elements, then is printed again in blue still showing three elements.

Expected:
Three gets printed in red followed by four being printed in blue to indicate the addition to the array.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

12
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.13.1
CreatedOct 12, 2016
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue