.h file includes:
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "PTZRCharacter.h"
#include "PTZRPortal.generated.h"
.cpp file function snippet:
void APTZRPortal::TeleportActor(AActor* ActorToTeleport)
{
if (ActorToTeleport == nullptr || Target == nullptr)
{
return;
}
//-------------------------------
//Retrieve and save Player Velocity
//(from the Movement Component)
//-------------------------------
FVector SavedVelocity = FVector::ZeroVector;
APTZRCharacter* EC = nullptr;
if (ActorToTeleport->IsA(APTZRCharacter::StaticClass()))
{
EC = Cast<APTZRCharacter>(ActorToTeleport);
SavedVelocity = EC->GetCharacterMovement()->Velocity;
}
Above is part of my code and the problem I am having is that VS is underlining the “EC” variable in the “SavedVelocity” definiton (last line) in red, telling me that “Pointer to incomplete class type is not allowed”. I am quite new to C++ in Unreal and I have no idea why I am getting this error. I have searched around on Google for this issue and all the answers basically tell them that they forgot to include a certain engine component. However I can’t think of what I could have possibly forgotten to include here. “EC” here is just a pointer to the “PTZRCharacter” class (a custom character class I made) and I have indeed included the header file of that class in my header file.
I can’t possibly think of anything else I need to include. Any ideas?