Unable to get Cast() working

I’m currently experiencing issues casting my player class to a volume I’ve created.

When debugging in VS17 the cast (Player) appears to come up NULL.

This is a function within a jump pad class.

void AJumpPadVolume::OnActorEnteredVolume(AActor * Actor, AActor * Actor2)
{
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("JP: Function called!")));
	AHomagePlayer* Player = Cast<AHomagePlayer>(Actor);

	// If the actor that touched the pad is a player then launch the player
	if (Player && Enabled)
		Player->SetVelocity(JumpVelocity);
}

I have added the Player header file to includes and nothing seems to happen.

When I check the Actor it comes up as the following:

LogTemp: Warning: Actor is /Game/Scenes/UEDPIE_0_dev_Test01.dev_Test01:PersistentLevel.JumpPadVolume_1 : 

So that appears to be working okay, from what I can tell.

Been looking at this for a few hours now while researching without any resolve. Would appreciate any assistance. :slight_smile:

What is the type of Actor2?

After doing some checks I found the following:

    LogTemp: Warning: Actor is /Game/Scenes/UEDPIE_0_dev_Test01.dev_Test01:PersistentLevel.JumpPadVolume_1 : 
    LogTemp: Warning: Actor2 is /Game/Scenes/UEDPIE_0_dev_Test01.dev_Test01:PersistentLevel.BP_HomagePlayer_C_0 : 
    LogTemp: Warning: Player is None :

I changed the cast like so:

AHomagePlayer* Player = Cast<AHomagePlayer>(Actor2);

And it appears to be working.

I’m calling the function like so:

OnActorBeginOverlap.AddDynamic(this, &AJumpPadVolume::OnActorEnteredVolume);

So I figured that Actor would be what I’m looking for and not Actor2. I was incorrect.