Adding 'self' to an array of another blueprint causes 'none' to be added

Quick summary:

Using node ‘self’ to populate an array in another blueprint causes ‘none’ to be added to that array instead of actor ‘self’ is pointing to. This was observed in 4.5.1

Detailed repro.

  1. Create two blueprints BP_1 and BP_2 with parent ‘Actor’ and place these in a test level.
  2. For testing purposes create a public variable ‘MyArrayContainer’ in BP_2 of type BP_1 and in level editor select instance of BP_2 we just added to level and set ‘MyArrayContainer’ in details panel to instance of BP_1.
  3. In BP_1 create an array variable ‘MyArray’ of type BP_2
  4. In BP_2 on event begin play use self node to add itself to variable ‘MyArray’ in ‘MyArrayContainer’.
  5. For testing if Add node works print contents of MyArray in Event Tick of BP_1. It is observed that MyArray is indeed populated with one entry, BUT entry is none/null instead of instance of BP_2 we added using self node!

I tested this in a new project as well and was able to reproduce it.

Hey VSZ,

I tested this as you described and my Print String returned BP_2. Can you post some images of your BP_1 and BP_2 Event Graphs, with variables selected so I can see their details in Details panel? Thanks!

Thanks for looking , I’ve uploaded images. I’ve also added a ‘test event’ on BP_2 that is invoked for each iteration of array. As you can see in output test event is in fact never invoked (because element resolved to none) and display name of actor also outputs an empty string.

BP_1

BP_2

PIE output

For my actual project I managed to workaround issue by creating a variable in target blueprint (i.e. BP_1) where I store instance of BP_2 (with self node again) and then add this variable to array instead of adding using self node directly.

Hey VSZ,

Thanks for images! I was able to reproduce issue in 4.5.1, and after doing some research it looks like we have some bugs with Self pointer in relation to array functions, Add included. This was fixed internally and is now working in 4.6, which you can download preview for now and which should have an official release soon. In meantime, setting a variable to Self on Begin Play and using that with your array functions is best workaround for this issue. Hope that helps!