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::GetAllActorsOfClass is inaccessable?

I have been trying to implement multiple different uses of UGameplayStatics but I consistently am met with the error of "UGameplayStatics::GetAllActorsOfClass is inaccessible". Based on documentation and everyone else, this clearly should not be the case.

I have been trying to use multiple different #include for referencing UGameplayStatics but none of them seem to make a change.

Sample Code:

 #include "MyAIController.h"
 #include "Kismet/GameplayStatics.h"
 
 void AMyAIController::Possess(APawn* Pawn)
 {
     Super::Possess(Pawn);
 
         TArray<AActor*> FoundActors;
 
         UGameplayStatics::GetAllActorsOfClass(GetWorld(), AAITargetPoint::StaticClass(), FoundActors);
 
 }

Am i referencing UGameplayStatics incorrectly or is there a bigger issue i should be looking for?

Product Version: UE 4.20
Tags:
more ▼

asked Sep 26 '18 at 12:34 AM in C++ Programming

avatar image

AedanFlynn
5 1 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I had the same problem. This approach worked for me better:

https://wiki.unrealengine.com/Iterators:_Object_%26_Actor_Iterators,_Optional_Class_Scope_For_Faster_Search

 #include "EngineUtils.h"
 #include "Engine/StaticMeshActor.h"
 
 for (TActorIterator<AStaticMeshActor> ActorItr(GetWorld()); ActorItr; ++ActorItr) 
    { 
         AStaticMeshActor *Mesh = *ActorItr; 
         UE_LOG(LogTemp, Warning, TEXT("Found Actor: %s"),*Mesh->GetName());
     } 

more ▼

answered Sep 26 '18 at 03:31 AM

avatar image

AyanMiru
323 4 6 13

(comments are locked)
10|2000 characters needed characters left
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