Creating a BP from a static mesh multiplies(the same) custom c++ component

I clicked on a static mesh door with a custom c++ component, DoorOpen, and when I went to BluePrints->Create Blueprint class from Actor in the menu above it created the BP but added 2 more OpenDoor components.

Project Location: GitHub - ericwomer/BuildingEscape: UDemy UnrealCourse BuildingEscape project
Branch: create_bp_extra_components

System Specs: KDE Neon (Ubuntu 16.04 based)
https://gist.github.com/salamanderrake/6bf86b942a1df33f0cadd82924dd9e23

UnrealEngine 4.15 Git d7900f13fa1652f81fb6195c055f49d2c35eaa41

Hey Salamanderrake-

Just to make sure I understand what’s happening, you created a C++ component, then created a blueprint (based on actor I assume?) that you added your custom component to. You then clicked on the blueprint in the content browser and created a new blueprint from this?

Can you confirm if this is the correct reproduction steps for the issue you’re seeing? If this is correct, what is the parent of the C++ component (actor component, scene component, etc.) If this is not the process you’re using, please let me know how to create a sample project to produce the same behavior on my end.

I created a custom c++ component, in the game world/map I added that component to a static mesh actor, I clicked on the static mesh in the level and up top I clicked on Blueprints and then ‘Convert Selected Actor to Blueprint Class…’ and it creates the BP, but it has two extra c++ components. So there ends up being 3 c++ components.

I’m still not sure I fully understand your process. Here are the steps I’ve taken in attempting to reproduce the issue:

  • Create a new project (Third Person Template)
  • Add code based on Actor Component (MyCompTest)
  • From Modes tab, add Basic Cube to the level
  • In cube details panel, Add instance of MyCompTest to the cube
  • Blueprint->Convert Selected Actor to Blueprint Class

The blueprint that is generated, as well as new instances of the blueprint, only have one instance of MyComptTest. Can you explain your exact setup or what I’m doing differently on my end?

That is exactly how I did it, but could you try it with the door from the StarterContent?

I tested the same steps above with the SM_Door and SM_DoorFrame meshes from starter content and did not have a duplicate component in the original instance, new instances, or the blueprint itself. What kind of component are you creating in code? Are you adding anything to the component? If so, can you provide the code that you’re using? Please list the steps that you’ve used so that I can make sure I’m following the same path.

It is on github, there are 3 doors, on that is a static mesh with a c++ component, one with a blueprint on how it should be ( I removed the extra components), and one that has 3 components still attached in the blueprint. Use the static mesh, with the component already attached and try to convert it to a BP.

Repo: GitHub - ericwomer/BuildingEscape: UDemy UnrealCourse BuildingEscape project
Branch: create_bp_extra_components

Hey Salamanderrake-

When I download the project from that branch it is unable to load the default map when the editor opens. I tried adding a new mesh to the blank viewport and place the OpenDoor component on it before converting to a blueprint, but the resulting blueprint still only had a single instance of the OpenDoor component. I also tried the project from the Master branch which did open the map. There were 3 instances of the door mesh here, all of which had one instance of the OpenDoor component. Attempting to create a static mesh from any of these also only produced a single component in the new blueprint.

Additionally, I tried to copy the code for your OpenDoor component into a new project/component class, but was unable to produce a blueprint with multiple instances. Are you only seeing this behavior with your OpenDoor component? If you create a new ActorComponent class with no changes / added code, does that also create additional component instances after converting a mesh to blueprint?

It does not create multiple components now but is causes other issues, I created a separate bug report.

Hey Salamanderrake-

Sorry for the late reply. Are you still seeing an issue when converting an actor to a blueprint causing components to duplicate? I tried testing again by creating my own ActorComponent class and copying the code from your OpenDorr class into it. I added an instance of my ActorComponent to the SM_Door mesh and converted to a blueprint but did not get any extra copies of my component in the blueprint. This was tested in 4.14 and 4.15. If you are still seeing this occur in 4.15, can you reiterate your setup in case I’ve missed something.

Cheers

Doug Wilson