I’m migrating from 4.14.3 to 4.15
I’ve commented the line
//#include “Engine.h”
in my main .h file
After having included all needed files in code, I’m facing a strange problem during compilation.
USoundCue* ImpactSound = GetImpactSound(HitSurfaceType);
if (ImpactSound)
{
UGameplayStatics::PlaySoundAtLocation(this, ImpactSound, GetActorLocation());
}
The compiler doesn’t recognize this as an UObject.
2>D:\KadeoGames\UDK\KSGM\Source\KSGM\Effects\KWeaponFireImpactEffect.cpp(50): error C2665: ‘UGameplayStatics::PlaySoundAtLocation’: none of the 2 overloads could convert all the argument types
2> D:\GitHub\UnrealEngine\Engine\Source\Runtime\Engine\Classes\Kismet/GameplayStatics.h(436): note: could be ‘void UGameplayStatics::PlaySoundAtLocation(const UObject *,USoundBase *,FVector,float,float,float,USoundAttenuation *,USoundConcurrency *)’
2> D:\KadeoGames\UDK\KSGM\Source\KSGM\Effects\KWeaponFireImpactEffect.cpp(50): note: while trying to match the argument list ‘(AKWeaponFireImpactEffect *const , USoundCue *, FVector)’
I’ve included the following files in the header
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "GameFramework/Actor.h"
#include "KFireTypes.h"
#include "KWeaponFireImpactEffect.generated.h"
UCLASS(Abstract, Blueprintable)
class AKWeaponFireImpactEffect : public AActor
{
GENERATED_UCLASS_BODY()
But the compiler does not recognize this as a derived AActor, and therefore a valid UObject.
If I keep the
#include “Engine.h”
in my main .h, not problem.
But as explained, in 4.15, do not include anymore the Engine.h to improve the compile time.
What header do I need to include ?
D.