Possessing pawn will not work

UE4 C++ Tutorial - How To Move Pawns - Pawn Movement - UE4 / Unreal Engine 4 Intro to C++ - YouTube I have followed exactly everything on this tutorial and I cannot possess the pawn for the life of me , I changed the game mode, made a pawn class and made a BP version and added that as my default pawn, added a spring arm and camera to my pawn BP . And then add it into my scene and press play , nothing happens, please help?

Here’s the header and cpp

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

#pragma once

#include “CoreMinimal.h”
#include “GameFramework/Pawn.h”
#include “PawnMovement.generated.h”

UCLASS()
class MYPROJECT89_API APawnMovement : public APawn
{
GENERATED_BODY()

public:
// Sets default values for this pawn’s properties
APawnMovement();

protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;

public:
// Called every frame
virtual void Tick(float DeltaTime) override;

// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

void MoveRight(float Value);
void MoveForward(float Value);

UPROPERTY(EditAnywhere, Category = "Movement Speed")
	float MovementSpeed = 500.0f;

FVector MovementDirection;

};

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

#include “PawnMovement.h”

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

}

void APawnMovement::BeginPlay()
{
Super::BeginPlay();

}

void APawnMovement::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
//updating the movement so on every tick i move some
if (!MovementDirection.IsZero())
{
const FVector NewLocation = GetActorLocation() + (MovementDirection * DeltaTime * MovementSpeed);
SetActorLocation(NewLocation);
}

}

void APawnMovement::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
//input bindings
InputComponent->BindAxis(TEXT(“MoveForward”), this, &APawnMovement::MoveForward);
InputComponent->BindAxis(TEXT(“MoveRight”), this, &APawnMovement::MoveRight);

}

void APawnMovement::MoveRight(float Value)
{
//when buttons are pressed for move right it’ll go from -1 to 1 for movement input, same on y
MovementDirection.X = FMath::Clamp(Value, - 1.0f, 1.0f);
}

void APawnMovement::MoveForward(float Value)
{
//movement on y axis
MovementDirection.Y = FMath::Clamp(Value, -1.0f, 1.0f);
}

Add this to your class constructor:

	AutoPossessPlayer = EAutoReceiveInput::Player0;
	AutoReceiveInput = EAutoReceiveInput::Player0;

or change these properties in you Pawn Blueprint.

I put that code in the constructor, nothing happens when I compile and press play .

Code is a little hard to read like this. Have you changed the game mode in your project settings (Edit → Project Settings → search for “Default GameMode”)?

If that’s not it, could you include a screenshot of your GameMode?

Make sure that your Pawn’s Blueprint is using these values too.
Sometimes the values in Blueprint don’t change when changing the C++ of an existing Blueprint.

If it stil doesn’t work post screenshot of your GameMode and Pawn’s Blueprint as @Dutii said.

Make sure the GameMode isn’t overridden in the world you’re trying to play in (setting in the World Details window).



Here.

Try making the PlayerController setting your own player controller too, not the default.
A simple blueprint BP_PlayerController would work fine.

I do not use “auto possess” but just set up the pawn and controller in the GameMode, and that does it, every time!

Stupid question, but are you sure that you’re actually playing in editor, instead of simulating? Check the play mode by clicking the arrow next to the play button.