Help Coding Skeletal Mesh

Hi, I’m programming my character into my unreal project. I’m having difficulty getting my example skeleton mesh to appear in the game. I’ve coded whats required and the editor shows that my character inherits the mesh but fails to appear when I insert the character into the game. I’m not sure what I’m missing in the code to make the example skeleton mesh to appear so i’m hoping I can find the answer here. Some of the code below I’m using from an coded example but I’m hoping to fix what’s wrong with it to get the character work. I’m only looking to code my project and not use blueprints for essential gameplay mechanics. Thanks for the assistance.
class PROJECTALPHA_API AHero : public ACharacter

// Sets default values for this character’s properties
USkeletalMeshComponent* mesh;


AHero::AHero(const FObjectInitializer& objectInitializer)
mesh = objectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT(“HeroMesh”));
RootComponent = mesh;
static ConstructorHelpers::FObjectFinder<USkeletalMesh> HeroSkeletalAsset(TEXT("/Game/Characters/HeroTPP/HeroTPP.HeroTPP"));
if (HeroSkeletalAsset.Succeeded())

mesh-&gt;AttachParent = GetCapsuleComponent();
mesh-&gt;bOnlyOwnerSee = true;
mesh-&gt;bOwnerNoSee = false;
mesh-&gt;bCastDynamicShadow = false;
mesh-&gt;bReceivesDecals = false;
mesh-&gt;MeshComponentUpdateFlag = EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered;
mesh-&gt;PrimaryComponentTick.TickGroup = TG_PrePhysics;


That is a very bad practice, Directly hardcoding path to an asset as string in your code is heavily discouraged , it can lead to a lot of inconsistencies.

Your current problem seem to be skeletal asset not being present at the path you typed in.

Best practice is to write all logic in code and when you need to refer an asset declare it as a UPROPERTY with EditDefaultsOnly or EditAnywhere in your code and then assign the asset in the blueprint based on your C++ class in the editor. This way you keep all the logic in C++ and still get to set the properties in editor , doing it this way you can move around your asset folder to folder and the editor will automatically keep track of the path.

Thanks Commander I appreciate the advise. It turns out the problem was with the lines relating to whether the owner sees the mesh or not. I removed it and the character appeared. However it seems the attached camera despite having a armtargetlength of 800.f is zoomed very close to the root location of the character’s foot. I raised the default spawn point thinking its a collision problem but the character stills spawns with the camera very close. I’m hoping you can help me with this camera.

So from what I can see the problem with the camera is capsule component. despite spawning well above ground the camera stays very close to the capsule component. The capsule itself is half matched and doesn’t shape around the body so is there any method to shape the component within code. Iv seen methods that adjust the size including half height but it isn’t working to cover the whole character mesh.