Can you edit it like this, set the GameMode in your project and test it?
CharacterController.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "CharacterController.generated.h"
/**
*
*/
UCLASS()
class CTEST_API ACharacterController : public APlayerController
{
GENERATED_BODY()
protected:
virtual void BeginPlay() override;
void Shoot();
};
CharacterController.cpp
#include "CharacterController.h"
void ACharacterController::BeginPlay()
{
Super::BeginPlay();
Shoot();
}
void ACharacterController::Shoot()
{
UE_LOG(LogTemp, Warning, TEXT("Some message from Shoot"));
}
Project2GameModeBase.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "CharacterController.h"
#include "Project2GameModeBase.generated.h"
/**
*
*/
UCLASS()
class CTEST_API AProject2GameModeBase : public AGameModeBase
{
GENERATED_BODY()
protected:
AProject2GameModeBase();
};
Project2GameModeBase.cpp
#include "Project2GameModeBase.h"
AProject2GameModeBase::AProject2GameModeBase()
{
PlayerControllerClass = ACharacterController::StaticClass();
}