Hello everyone.
I have a problem with my Tick function inside the C++ AIController. It was working correctly, then suddenly its stopped and I don’t know why.
The Tick function is not doing anything, even a log is not printed out. Everything that I write inside this function, is not executed.
I already checked my BP where I set the AIController, the option “Start with Tick Enabled” and “Allow Tick Before Begin Play” and is all set correctly.
This is the code in .cpp file:
#include "MyAIController.h"
#include "Kismet/GameplayStatics.h"
#include "MyCharacter.h"
void MyAIController::BeginPlay()
{
Super::BeginPlay();
AActor* playerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
SetFocus(playerPawn);
//MoveToActor(playerPawn, 200);
}
void MyAIController::Tick(float DeltaSeconds) {
Super::Tick(DeltaSeconds);
AActor* playerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
MoveToActor(playerPawn, 200);
}
Code in .h file:
#pragma once
#include "CoreMinimal.h"
#include "AIController.h"
#include "MyAIController.generated.h"
/**
*
*/
UCLASS()
class MYTESTGAME_API MyAIController : public AAIController
{
GENERATED_BODY()
public:
virtual void Tick(float DeltaSeconds) override;
protected:
virtual void BeginPlay() override;
};
Thanks for the help in advance