My UE4 does not load in components correctly

Hi,

I am having trouble using UE4 because for some reason when I add a component to my character via code, it does not seem to load in properly. I have added a static mesh component, but when I compile it and drag an instance of my class into the scene, the component is not there. Also, if I create a blueprint of the class and open it in the blueprint editor, the component is there but when I try to edit it, the window where you usually edit the values of the component is completely blank and I can’t edit anything.

The way I am creating my components is by doing this:
PlayerCharacter.h:
UStaticMeshComponent* meshComponent;

PlayerCharacter.cpp:
meshComponent = CreateDefaultSubobject’<‘UStaticMeshComponent’>’(TEXT(“Mesh”));
meshComponent->SetupAttachment(RootComponent);

Please note, I have put apostrophes around the angular brackets because otherwise, it thought it was an HTML tag. They are not there in the actual code.

This is valid code, right?

Does anyone know why this is happening?

Thanks

Man, I am having a similar issue. If I use a different name provided with TEXT(“name”), I have to reload the project in order for it to pick up the name, and then the blueprint stops showing the variables on the right for the blueprint, and I also can not touch the transform. Check my topic out and see the screenshots. Let me know if you have found a fix. I will notify you as well.

Have you declared the meshComponent variable using a UPROPERTY() tag in the header file? I am not sure if that is what is causing the issue, but it might help.

Smelnick97, check my topic, I am literally not writing any code, just changing TEXT(“Name”) and using the auto-generated C++ file from Unreal, and it still bugs out

@ChopperGW I have left a comment on your question, but while I am actually able to replicate the problem you have, I am not able to replicate @Nemozzz 's problem.

Could you post a bit more of your code @Nemozzz ? Specifically, can you show the full function in which you are creating the static mesh component?