x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UgamePlayStatics (name followed by '::' must be a class or namespace name)

Hi I am trying to make an AI enemy. I am using this tutorial https://www.youtube.com/watch?v=3Z1A825gTA8 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(GetWorld(), AAIPatrolPoint::StaticClass(), PatrolPoints);
     
         BehaviorComp->StartTree(*AICharacter->BehaviorTree);
     }
 }
 

 



Product Version: UE 4.21
Tags:
more ▼

asked Dec 27 '18 at 11:24 PM in C++ Programming

avatar image

kuboMagi
1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

It's UGameplayStatics not UGamePlayStatics, in C++ names of all entries are case sensitive.

more ▼

answered Dec 27 '18 at 11:27 PM

avatar image

Shadowriver
37.2k 936 172 1116

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Yes It worked. It was stupid mistake.

more ▼

answered Dec 28 '18 at 06:39 AM

avatar image

kuboMagi
1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question