If an existing AddComponent node is placed in an Actor Blueprint's Event Graph for a custom ActorComponent-based Blueprint Class, the node will fail to be scheduled after adding a variable marked "Expose on Spawn" to the ActorComponent-based Blueprint Class.

Also, in //UE4/Main (4.11), the AddComponent node will produce an error after the variable is added (Invalid class 'REINST_PayloadComponent_C_206' used as template by 'Add REINST Payload Component C 206'...) It's removed after explicitly recompiling the Blueprint Class. The error does not occur in 4.9/4.10.

Remove the Expose on Spawn variable from the ActorComponent-based Blueprint Class, then delete and re-add the AddComponent node in the Actor Blueprint's Event Graph.

Steps to Reproduce

1. Launch QAGame editor.
2. Create 2 new Actor-based Blueprint Class assets, and 1 new ActorComponent-based Blueprint Class (named Bullet, Gun and PayloadComponent respectively).
3. Open the "PayloadComponent" in the Blueprint editor and add a PrintString node linked to the BeginPlay event in the Event Graph. Compile and save.
4. Open the "Gun" Blueprint Class in the Blueprint editor and add a "Spawn Actor from Class" node linked to the BeginPlay event in the Event Graph. Change the 'Class' input to 'Bullet' and link a MakeTransform node to the Spawn Transform input.
5. Right-click and type 'AddPayloadComponent' and choose the "Add PayloadComponent" item to add the node. Link it to the SpawnActorFromClass node and link the 'Return Value' output pin to the 'Target Actor' input pin on the AddComponent node. Compile and save.
6. Drag the 'Gun' Blueprint Class into the level to add an instance.
7. Start PIE. Note that "Hello" is printed out.
8. Quit PIE and re-open the PayloadComponent Blueprint Class in the Blueprint editor.
9. Add a new variable of type 'Actor' (reference), and make sure it's marked "Editable" and "Expose on Spawn." Compile and save.
10. Open the Gun Blueprint Class in the Blueprint editor once more and notice that the AddComponent node does not show the variable that was added in the previous step. (Also note that in 4.11/main the node is now displaying an error.)
11. Right-click on the AddComponent node and choose "Refresh Nodes." Note that the variable is now shown as an input pin.
12. Compile and save, close the Blueprint editor and launch PIE again.

No message is printed out as expected.


Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-23340 in the post.

Login to Vote

Cannot Reproduce
ComponentUE - Gameplay - Blueprint
Affects Versions4.94.10
Target Fix4.11
CreatedNov 13, 2015
ResolvedJan 14, 2016
UpdatedApr 27, 2018