UGameplayStatics Where is it defined?

I’m trying to spawn an emitter when my weapon impacts the wall. So I looked into the shooter game example. and saw that I can do something like this…

UGameplayStatics::SpawnEmitterAtLocation(this, HitWallFX, Result.ImpactPoint, Result.ImpactNormal);

However UGameplayStatics is defined nowhere in the Shooter Example and I cant find where it may be defined.

Thanks.

if(Result.GetActor() != NULL)
{
           //Show where the weapon hit
           if(!bHitActor)
		   {
			 PlaySoundAtLocation(WeaponWallImpact,Result.ImpactPoint,1.0,1.0);  
			 DrawDebugLine(GetWorld(),Mesh->GetSocketLocation(TEXT("WeaponHilt")), Mesh->GetSocketLocation(TEXT("WeaponHiltEnd")), FColor(0,255,0), false, 1.0,0, 2.0);
			 bHitActor = true;
			 GetWorldTimerManager().FTimerManager::SetTimer(this, &ASoulHunterCharacter::EndHitWall, 0.3f, false);
			 //UGameplayStatics::SpawnEmitterAtLocation(this, HitWallFX, Result.ImpactPoint, Result.ImpactNormal);
		   }
}

You should just need to include:

#include "EngineKismetLibraryClasses.h"
1 Like

Thanks that seems to work!

In my case (UE 4.16.1), I couldn’t use UGamePlayStatics with that #include, but this worked:
#include “Runtime/Engine/Classes/Kismet/GameplayStatics.h”

This can be reduced to #include "Kismet/GameplayStatics.h"

3 Likes