Newbie question: Why won't the game run as the character I've made?

So I know how to start from scratch with blueprints and make a character, but I want to do it in C++. When I start from scratch and make a new character in c++, the game doesn’t run as my character.

Here is my code:

snow.cpp



// Fill out your copyright notice in the Description page of Project Settings.

#include "TestGame.h"
#include "Snow.h"


// Sets default values
ASnow::ASnow()
{
 	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	//create camera
	FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
	FirstPersonCameraComponent->SetupAttachment(GetCapsuleComponent());
	FirstPersonCameraComponent->RelativeLocation = FVector(-39.56f, 1.75f, 64.f); //pos of camera
	FirstPersonCameraComponent->bUsePawnControlRotation = true;

	//first person mesh stuff
	Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
	Mesh1P->SetOnlyOwnerSee(true);
	Mesh1P->SetupAttachment(FirstPersonCameraComponent);
	Mesh1P->bCastDynamicShadow = false;
	Mesh1P->CastShadow = false;
	Mesh1P->RelativeRotation = FRotator(1.9f, -19.19f, 5.2f);
	Mesh1P->RelativeLocation = FVector(-0.5f, -4.4f, -155.7f);
}

// Called when the game starts or when spawned
void ASnow::BeginPlay()
{
	Super::BeginPlay();
	
}

// Called every frame
void ASnow::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );

}

// Called to bind functionality to input
void ASnow::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	check(InputComponent);

	InputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump);
	InputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping);

	InputComponent->BindAxis("MoveForward", this, &ASnow::MoveForward);
	InputComponent->BindAxis("MoveRight", this, &ASnow::MoveRight);


}

void ASnow::MoveForward(float Value)
{
	if (Value != 0.0f)
	{
		AddMovementInput(GetActorForwardVector(), Value);
	}
}

void ASnow::MoveRight(float Value)
{
	if (Value != 0.0f)
	{
		AddMovementInput(GetActorRightVector(), Value);
	}
}



snow.h



// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/Character.h"
#include "Snow.generated.h"

UCLASS()
class TESTGAME_API ASnow : public ACharacter
{
	GENERATED_BODY()

		//1st person view
		UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
		class USkeletalMeshComponent* Mesh1P;

		//1st person camera
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))
		class UCameraComponent* FirstPersonCameraComponent;

public:
	// Sets default values for this character's properties
	ASnow();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;
	
	virtual void Tick( float DeltaSeconds ) override;

	FORCEINLINE class USkeletalMeshComponent* GetMesh1P() const { return Mesh1P; }

protected:
	void MoveForward(float Val);
	void MoveRight(float Val);
	virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
	
};


I’m not sure if it’s not running as my character, or if the code just isn’t set up properly. I used a premade FPS template to try and figure out what I needed to write to make my own camera setup and character. Anyone know what I’m doing wrong?

Did you tell the game mode for the map to use your character?

You need to tell the engine which character to use.
This can be done manually for each map or by creating a new base game mode (better option).

For instance, if you created a new game mode call ASnowGameMode:



ASnowGameMode::ASnowGameMode::(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer)
{
    DefaultPawnClass = ASnow::StaticClass();
}


And then in your DefaultEngine.ini file (Replace with the name of your game):



[/Script/EngineSettings.GameMapsSettings]
GlobalDefaultGameMode=/Script/<GameName>.SnowGameMode
GlobalDefaultServerGameMode=/Script/<GameName>.SnowGameMode