Failed to add custom component at runtime

I’m tried to add a custom component to blueprint A by blueprint B at runtime.
If the custom component doesn’t have any variable “expose on spawn”,
everything will be fine.
Custom component will be added to blueprint A, variable will be set before beginplay.

However, if I add a variable with “expose on spawn” checked,
component will be added to wrong blueprint B,
and it won’t call beginplay or it calls beginplay without setting the variable.
Lots of strange things will happen.

Is this a bug?
Should I only call add component only in blueprint A?

Can you show a screenshot of how you’re spawning the component and add it to the other blueprint?

Correct (Added to TestActor):


Wrong (Added to TestSystem):


Hello Katalla,

What does your Add Test Component function look like? Could you provide a screenshot?

Test Component is a custom component. I just call the add component function.
It’s a default function generated by Unreal for every class inherented to Actor Component.

I have attempted to reproduce your issue, but I haven’t been able to do so. Could you create and attach a simple test project that shows your issue so that I could get a better look at what’s causing the problem? Thank you.

Our version is 4.9.0 with PS4 platform.
Test Project:
[link text][1]

Test Method:

  1. Use Main.umap as Game Default Map

  2. Press Play to simulate

  3. TestSystem will add CorrectComponent to TestActor but add WrongComponent to TestSystem itself

CorrectComponent’s Debug Filter:


WrongComponent’s Debug Filter:



I have been able to reproduce your issue, and have entered a bug report, UE-22839. Thank you for your report, and for providing a test project.

Have a great day,

Sean Flint

A fix has been committed to the 4.11 release branch. Terrible bug, thanks so much for following up on it.

The fix is quite small, so if you’re building your own version of the engine it is trivial to pull in.