I’ve double checked everything with the resource files Ben listed, but when I play the game in the editor, I’m not getting anything in the output log from the UE_Log code. There just isn’t anything showing up. The game compiles without any error or warning, and it plays, and I can move the camera around in the game, but, no log message. I’m copying my code here.
[code]
tankplayercontroller.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “Public/Tank.h”
#include “GameFramework/PlayerController.h”
#include “TankPlayerController.generated.h” // must be the last include
/**
*
*/
UCLASS()
class BATTLETANK_API ATankPlayerController : public APlayerController
{
GENERATED_BODY()
public:
ATank* GetControlledTank() const;
virtual void BeginPlay() override;
};[/code]
tankplayercontroller.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "BattleTank.h"
#include "TankPlayerController.h"
void ATankPlayerController::BeginPlay()
{
Super::BeginPlay();
UE_LOG(LogTemp, Warning, TEXT("Begin Play"));
auto ControlledTank = GetControlledTank();
if (!ControlledTank)
{
UE_LOG(LogTemp, Warning, TEXT("playercontroller not possessing a tank"));
}
else
{
UE_LOG(LogTemp, Warning, TEXT("playercontroller possessing: %s"), *(ControlledTank->GetName()));
}
}
ATank* ATankPlayerController::GetControlledTank() const
{
return Cast<ATank>(GetPawn());
}
[code]
tank.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “GameFramework/Pawn.h”
#include “Tank.generated.h”
UCLASS()
class BATTLETANK_API ATank : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn’s properties
ATank();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
};[/code]
[code] tank.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include “BattleTank.h”
#include “Tank.h”
// Sets default values
ATank::ATank()
{
// 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 ATank::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ATank::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
}
// Called to bind functionality to input
void ATank::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
}[/code]