Blueprint from component class duplicated if added by Add Component in BP Editor

After starting to using blueprint component classes I noticed this bug.

  1. Create a Blueprint from a ActorComponent class, for example from a c++ class derived from UStaticMeshComponent with UCLASS(Blueprintable, meta=(BlueprintSpawnableComponent)) specified.

  2. Create a Blueprint from a Actor class.

  3. In the actor blueprint, use AddComponent and add your ActorComponent Blueprint, it is under the Custom group.

  4. Notice that GetComponents function will then return duplicates of the component you added. The duplicate will be named with _C suffix. The UClass seems to be the same though, it is not a template.

Adding your ActorComponent Blueprint by code with NewObject with the ActorComponent Blueprint class as parameter does not cause this bug and if you do that no duplicate is created.

Hi Markus,

  • Does this occur in a clean, blank project with no additional content or is it limited to one project?
  • Can you show me a screenshot of what you are seeing on your end?
  • Do the duplicates disappear once you compile the owning blueprint?

Yes, it occurs in a blank project.

I don’t have a screenshot, but there is two instances of every added component and when doing breakpoints in Visual the list of components is twice the size.

No, they are still there after you have compiled the blueprint,

Does this only occur in blueprints that are derived from custom C++ classes or has it occurred in blueprints that are derived directly from blueprint classes?

I never tested that. I created one c++ class derived from UStaticMeshComponent and one c++ class derived from USplineMeshComponent. Then I created one component blueprint class from each of those two, and then added those as components to an actor blueprint class. In both cases the components were duplicated. This did not happen when I added them with NewObject<> in c++ code, it only happened when I added them with Add Component in the blueprint editor.

Hi Markus,

Unfortunately I was unable to reproduce this with the steps given. Do you have a test project I can view this occurring in?

HI Markus,

We have not heard from you in several days. I am marking this as answered for tracking purposes, if you are still experiencing this error, please comment with the requested information.

The duplicate only shows up when doing Play. It is not visible in the blueprint editor.

Can you post a sample project where this is occurring so I can take a look? It may help to discover what is causing the error you are seeing.