Why do I get two identical meshes in blueprint

Hello, I have an issue that has been with me since way back, maybe before 4.9. I noticed it but it didn’t trouble me, today I realized it’s actually impacting my project.

Basically I add a mesh in from C++ in the constructor of my player character as follows (the one pertinent to my question is the one called “Mesh”:

   FirstPersonMesh = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("FirstPersonMesh"));
   FirstPersonMesh->SetOnlyOwnerSee(true);         // only the owning player will see this mesh
   FirstPersonMesh->AttachToComponent(FirstPersonCameraComponent, FAttachmentTransformRules::KeepRelativeTransform);
   FirstPersonMesh->bCastDynamicShadow = false;
   FirstPersonMesh->CastShadow = false;
   ThirdPersonMesh = ObjectInitializer.CreateOptionalDefaultSubobject<USkeletalMeshComponent>(this, TEXT("Mesh"));
   ThirdPersonMesh->SetOwnerNoSee(true);
   ThirdPersonMesh->AttachToComponent(GetCapsuleComponent(), FAttachmentTransformRules::KeepRelativeTransform);

Then when I create a Blueprint that has my C++ class for a parent class, I end up with two copies of this mesh.

123239-uequestion.png

I didn’t worry about this when I noticed it because it seemed to have no impact and I assumed it was some sort of ghost in the component window that wasn’t actually causing any execution of code. Then today, I noticed that displays I had in my animation blueprint, were doubling and on closer examination, they both had different values for log displays I was checking. If I comment my mesh creation as shown in the C++ code above, both copies go away. When I iterate within the program to set various values, changes are only reflected in one, the first one I get back when I look up the SkeletalMeshComponent (naturally because I only use index 0), so for example a gun gets assigned to one and not the other, physics changes occur to one and not the other, and worse, both are running discrete copies of the Animation blueprint.

I tried recreating my Blueprint from scratch, and it still ends up with two copies of the Mesh.

What could I be doing to cause two copies of the mesh called “Mesh” to generate in the blueprint from a single CreateDefaultSubobject? As it turns out, one provides me with a shadow for my FirstPersonMesh, so there may be a reason why I did this cluelessly, but it’s disconcerting that I can’t find anywhere in my code where I’m generating it and possibly, the shadow I have been getting all along is merely accidentally leveraging another bug. If it is a bug, I’d like to figure it out since two sets of animation blueprints running seems like a bad idea.

In case someone runs into this. I found the answer. If you create a mesh in the blueprint, then do a CreateDefaultSubobject, the originally created mesh disappears from the blueprint as it’s original name. The name used in CreateDefaultSubobject is then also put on the original one and if they are the same mesh, it appears to be a duplicate (and is, sort of). I found this by commenting the CreateDefaultSubobject and looking at the blueprint, whereas the original mesh appeared under it’s correct name.

The issue that arises as a result of this, is that you can’t tell which mesh you are making changes to and changes (for example collision changes) do not apply to both. It create confusion, iterating through the skeletal mesh components causes element 0 to be the last one, while a GetMesh() will return the first one. This makes it confusing to determine which one you are accessing.