Issues with movement in Unreal

Hello

I’m currently on video 167 of Simple Shooter, have entered all the code correctly (To my knowledge) and didn’t get any errors while compiling but as soon as I press play in Unreal, nothing happens, I cannot move and I’m not sure why or if I’ve missed anything.

Anybody have any ideas?

Thank you

ShooterCharacter.cpp

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


#include "ShooterCharacter.h"

// Sets default values
AShooterCharacter::AShooterCharacter()
{
 	// 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;

}

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

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

}

// Called to bind functionality to input
void AShooterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

	PlayerInputComponent->BindAxis(TEXT("MoveForward"),this, &AShooterCharacter::MoveForward);
	PlayerInputComponent->BindAxis(TEXT("LookUp"),this, &APawn::AddControllerPitchInput);
	PlayerInputComponent->BindAxis(TEXT("MoveRight"),this, &AShooterCharacter::MoveRight);
	PlayerInputComponent->BindAxis(TEXT("LookRight"),this, &APawn::AddControllerYawInput);
	PlayerInputComponent->BindAction(TEXT("Jump"), EInputEvent::IE_Pressed, this, &ACharacter::Jump);
}

void AShooterCharacter::MoveForward(float AxisValue) 
{
	AddMovementInput(GetActorForwardVector() * AxisValue);
}

void AShooterCharacter::MoveRight(float AxisValue) 
{
	AddMovementInput(GetActorRightVector() * AxisValue);
}

// void AShooterCharacter::LookUp(float AxisValue) 
// {
// 	AddControllerPitchInput(AxisValue);
// }

ShooterCharacter.h

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "ShooterCharacter.generated.h"

UCLASS()
class SHOOTERASSETPACK_API AShooterCharacter : public ACharacter
{
	GENERATED_BODY()

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

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;

	private:
		void MoveForward(float AxisValue);
		void MoveRight(float AxisValue);
		// void LookUp(float AxisValue);

};

MyPawn.cpp

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


#include "MyPawn.h"

// Sets default values
AMyPawn::AMyPawn()
{
 	// 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;

}

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

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

}

// Called to bind functionality to input
void AMyPawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

}

MyPawn.h

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "MyPawn.generated.h"

UCLASS()
class SHOOTERASSETPACK_API AMyPawn : public APawn
{
	GENERATED_BODY()

public:
	// Sets default values for this pawn's properties
	AMyPawn();

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;

};


Is your blueprint derived from your ShooterCharacter class and is it the default pawn in your game mode?

I’m not sure to be honest. I didn’t do anything with the Pawn yet, just the ShooterCharacter section.

Section 6: Simple Shooter, video 167.

You could try adding a log in BeginPlay and seeing if it shows up.

Hello

So, I’ve tried restarting the Unreal editor, I’ve gone over both videos (166 and 167) to see if I missed anything or made a mistake somewhere. They do mention something about cloning the Pawn with the ShooterCharacter, but I don’t know or I’ve forgotten how to do that.

Video 166, 8:25 - 9:00. This is just before they duplicate the map, I’m not sure if I missed something else there.

I tried adding a log like you suggested but nothing happened. (I’m guessing you meant an error log that should display in the console log of the editor?)

Also, when I duplicated and copied the map I got an extra icon/file ‘Sandbox built data’ (Map build data registry).

I’ve tried compiling again and haven’t gotten any errors, just not sure where I may have gone wrong in the Unreal editor. I’ll keep trying to figure out what the problem is but so far I’m having no luck.

Could you show the BP_ShooterCharacter blueprint?

@DanM

Hello. Is this the blueprint you are talking about?








Yup and that seems fine. Could you show your input mappings? Edit > Project Settings > Input.

@DanM



Your error is in the first screenshot, do you see it?

@DanM

Hmmm, not really.

Forwrad

Oh wow. I don’t know how I missed that. I’ve saved and compiled again and it still won’t move. Could it be a bug in Unreal? Or may I have missed something else?

I think I’ll need to look at your project to debug further. Do you remember how to send?

I think so. Was it File > Package Project > Zip Up Project, or something like that?

Yup and then send that to https://gdev.tv/projectupload unless it is too large then by any other file host and then send a link to this thread or via pm.

It is too big, yeah. What do you mean by file host?

Sorry I forgot to reply but a site that allows you to upload files and share them like Google Drive or DropBox

Okay, I think I managed to upload it with google drive. https://drive.google.com/file/d/1DZ6nY_68FonIO0gSGBp38O87COQARMKY/view?usp=sharing

Your must be working on the asset pack project which you migrated from. The project you sent me has an empty character class

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


#include "ShooterCharacter.h"

// Sets default values
AShooterCharacter::AShooterCharacter()
{
 	// 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;

}

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

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

}

// Called to bind functionality to input
void AShooterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

}

Privacy & Terms