Hey all,
So everything worked untill I made an edit within a c++ class that is baised on an actor the issue is I’ve added a new method in the c++ class auto generated by UE the error it throws in the crash dump is
Exception Code: 0xC0000005
Exception Information: The thread tried to read from or write to a virtual address for which it does not have the appropriate access.
Here’s the Tank.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "Tank.generated.h"
UCLASS()
class BATTLETANK_API ATank : public APawn
{
GENERATED_BODY()
public:
void AimAt(FVector OutHitLocation);
private:
// 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 DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
};
Here’s the method in the cpp file
void ATank::AimAt(FVector OutHitLocation)
{
auto OurTankName = GetName();
UE_LOG(LogTemp, Warning, TEXT("%s aiming at %s"), (*OurTankName, *OutHitLocation.ToString()))
}
And the calling method in my player controller
void AMyTankPlayerController::AimTowardsCrosshair() const
{
if (!GetControlledTank())
{
return;
}
FVector OutHitLocation;
if (GetSightRayHitLocation(OutHitLocation))
{
GetControlledTank()->AimAt(OutHitLocation);
}
}