Component Hierarchy not consistent between BP class and instance (SplineMesh not parenting properly)

Build Type: Source build

Build version: 4.11.2

Issue: When I make an instance of a BP class, the component hierarchy is not the same as it is in the BP class. This only began occurring after the update to 4.11. Crane instances made previous to that are correct.

The component hierarchy in the BP class: (note the hoistMesh is parented to the hoistSpline)

88355-crane_bp.jpg

The component hierarchy in the instance: (note the hoistMesh is no longer parented to the hoist Spline)

88356-crane_instance.jpg

Repro steps:

  1. Drag and drop CraneBP from the Content Browser to the level viewport.
  2. Check the component hierarchy in the details panel and compare it to that in the blueprint class.

Update: I have attached the .cpp/.h for the crane, which this BP inherets from, as well as the crane uasset file. [Here.][3]

Update: Using the code method Sean recommended. Note that the hoistMesh is supposed to be parented to the hoistSpline.

Hello,

  • Does this only occur with a particular blueprint?
  • Is this blueprint based off of a C++ class?
  • Have you been able to reproduce this in a clean project?

Hello, thank you for the response. This is a blueprint derived from a C++ class, and I have only noticed it with this blueprint so far. I am trying it with a clean project right now and I will let you know.

Same behaviour in a clean project.

I added bugreport.zip, which has the c++ and uasset files.

I haven’t been able to reproduce the issue using anther asset unfortunately.

Try recreating that particular blueprint from scratch and seeing if you get the same results with the clean version of the blueprint.

Did you make it using the C++ files that I attached to the question? I did recreate the blueprint in a new project, using those code files, and had the same problem.

I am attempting to reproduce this issue with a clean asset in order to determine if the issue is asset-specific, or if it relates to something that has somehow become corrupted in your original asset.

If you could recreate the code classes and blueprint, not necessarily in a new project as long as the asset itself is from scratch, that would help determine if this is an issue with corruption or if it is something that you have set up in your code.

The code files I have attached are bare-bones versions of the ones in my project (all the functionality is cut out, it is just the component initialization). I made a new project and completely recreated the asset with those bare-bones C++ files, and still had the problem. Is that what you mean by “from scratch”?

I also made a new, similar actor, without being derived from C++, and it seems to work okay. So I wonder if something in my code is the problem? But why would it have worked in 4.10 and in the blueprint itself, but not the instances?

It’s definitely possible that it is an issue with the code, since neither of us have been able to reproduce it in a clean project, or with a new asset. I’ll continue to take a look at the code and see if I can find anything that could be causing this issue. In the meantime please respond back if you find any additional information during your testing.

Thank you

Well I was able to reproduce it in a clean project, but I haven’t seen it happen with any other assets based off of C++ files. I think it might be spline-related.

When you say that it is spline-related, do you mean that it happens to any blueprint that contains a spline component? Have you been able to verify that this is the case?

When you reproduced it in a clean project, was it with the same asset or did you create a new asset?

What I did:

1 - Make a new project

2 - Make a new C++ class through the editor

3 - Copy paste the component initialization code only

4 - Make a blueprint derived from the new C++ class - hierarchy looked good

5 - Make an instance of that new blueprint in the level - hierarchy was broken the same way

From what I can tell, it seems to happen consistently when you try to parent a spline mesh to a spline in C++.

In fact, it doesn’t seem to matter what I parent the spline mesh to it does the same thing (correct in blueprint, incorrect in instance).

Thank you for providing the additional information. However, I have not been able to reproduce the issue in a clean project on my end. Could you please zip up and provide your entire project? You can upload it to Dropbox and send me a link through PM on the forums: https://forums.unrealengine.com/member.php?160394-Sean-Flint

Have you tried it inherited from C++ classes? It doesn’t happen otherwise. If you confirm that you have tried that, then I will zip my project and see about getting it on drop box :). Thanks for your help!

Yeah I have tried it when inheriting from a code class but I wasn’t getting the same behavior so it looks like I’m overlooking a small step. Looking at the project will allow me to determine what this could be. Thanks!

Here is the initialization code that I’m using in my .cpp class:

BoxComp = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxComp"));
    
    
    BoxComp->AttachTo(RootComponent);
        
SplineMesh = CreateDefaultSubobject<USplineMeshComponent>(TEXT("SplineMesh"));
    
    
    SplineMesh->AttachTo(BoxComp);

I have the BoxComponent set as the root component, and then the Spline Mesh is attached to the Box Component. I noticed that you were using PCIP, which is outdated API and no longer necessary, as well as using AttachParent instead of the AttachTo function. Try using AttachTo instead because that seems to work for me. Using the initialization code above, I did not see any inconsistencies in my hierarchy in the blueprint instance that I added to my level.