Issue with components location being moved when creating a blueprint class from a c++ class

Hey there!

I am having an issue with my blueprints that inherit from C++ classes in UE4.10.

I have a text render component that is being used to prototype the health system. It has its relative location set to 0,0,100 in the constructor.

When I put the C++ version of my class in the scene, everything works fine. The text render component follows the player as I hoped during gameplay.

However, if I create a blueprint inherited version of my class, when I begin play the text render component detaches itself from my pawn, and doesn’t follow the player at all. The blueprint version is NO different than the C++ class, and the issue still happens.

So, the blueprint looks like this in the editor:

71480-capture.png

and then this in gameplay:

71491-capture_broken.png

The C++ class doesn’t have this issue.

Anyone seen this before? Any ideas on how to fix it?

Cheers,

I have seen this issue a few occasions - mostly during migration from one engine version to the next. I’ve not seen it on a text render component but other UPrimitiveComponent derivied classes (eg: static mesh component) have presented this issue.

The following workarounds seemed to work for me: (your mileage may vary)

  1. Mark your scenecomponent and textrendercomponent as EditAnywhere instead of whatever you’ve set it to now. I received this tip from a dev on this thread - the workaround itself is questionable - but it solved my issue of the component not being attached and moving back to origin instead of following the player.

  2. Revisit the code you’re using to attach your text render component to the root component. Using the AttachTo function v/s setting AttachParent directly seems to have subtle differences for BP derived classes. Whether you’re attaching it in the constructor or later (eg: PostInitializeComponents ) also makes a difference in some cases.

Hope this helps. The workarounds may not be directly applicable to your specific issue but it’s worth a shot to narrow down the issue at least.

Also try posting the code you’re using to attach your component as well in case someone can spot a flaw there.

Good luck.

thank you ! Setting the components that were having issues to EditAnywhere solved the problem. Appreciate the help.
Cheers mate.

Great. I’ll bump the other thread to remind the Epic dev about this as well. This workaround shouldn’t be needed ideally and it also clutters up the view on more complex components like static mesh components. Still, glad you’re able to move forward.