Hi I am trying to make an AI enemy. I am using this tutorial Unreal Engine C++ Tutorial - Stealth Game AI - YouTube and I am running UE 4.21.1 and Visual Studio Community 2017 version 15.9.4. In my AIPatrolController.cpp file is compiler giving me an error that name followed by ‘::’ must be a class or namespace name. I tried to include “Kismet/GameplayStatics.h” but it didn’t help.
#include "AIPatrolController.h"
#include "AIPatrol.h"
#include "AIPatrolPoint.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BehaviorTree.h"
#include "Kismet/GameplayStatics.h"
void AAIPatrolController::Possess(APawn * Pawn)
{
Super::Possess(Pawn);
/*Get reference to the character*/
AAIPatrol* AICharacter = Cast<AAIPatrol>(Pawn);
if (AICharacter)
{
if (AICharacter->BehaviorTree->BlackboardAsset)
{
BlackboardComp->InitializeBlackboard(*(AICharacter->BehaviorTree->BlackboardAsset));
}
/*Populate patrol point array*/
UGamePlayStatics::GetAllActorsOfClass((), AAIPatrolPoint::StaticClass(), PatrolPoints);
BehaviorComp->StartTree(*AICharacter->BehaviorTree);
}
}