Eratic compiler behaviour

Ok, I am having some major issues programming in C++ with the Engine for days now and I really would like an answer to this question. This is a simple USkeletalMesh variable I would like to add to my Character C++ class (so I can add it to the Blueprint deriving from this class). This is where I declare the variable:

FPSCharacter.h

UPROPERTY (VisibleDefaultsOnly, Category = Mesh)
USkeletalMeshComponent *handsMesh;

FPSCharacter.cpp

handsMesh = CreateDefaultSubobject <USkeletalMeshComponent>(TEXT("Our hands mesh"));
handsMesh->SetOnlyOwnerSee(true);
handsMesh->SetupAttachment(ourCameraComponent);
handsMesh->bCastDynamicShadow = false;
handsMesh->CastShadow = false;
GetMesh ()->SetOwnerNoSee(true);

The error I am getting is that none of the above function/attributes of the class belong to the class. That means the class definition is included, but the attributes and functions are not. How is this even possible?

Ok, the code compiles now (after absolutely no change) but nothing appears to happen in the Editor and PIE. Is there any reason for this?

Hi,

Is there a reason that you’re attaching it to your CameraComponent? You should probably consider attaching it to your RootComponent instead: handsMesh->SetupAttachment(RootComponent) or just completely assign it to your RootComponent as such: RootComponent = handsMesh. Another thing to note is the Category specifier inside your UProperty. You must use = instead of colon (:slight_smile: or your code will not compile! Lastly, if by no change you mean that Editor does not Hot Realod when you compile your code, then please refer to my answer here where I explain a simple solution.

Hope this helps.

I had used =, I don’t know how the : got there. Obviously something really bad is going on on my part.

Anyway, I 'm just following the FPS Third Person C++ Tutorial, and these are the attachments the tutor shows in the tutorial. Anyway, I can’t even begin to imagine what’s going on. Thank you anyway. :wink: