Download

GetPlayerCharacter in Blueprint

I’m using UE 4.11 and VS 2015 Enterprise. I’m following the tutorial video from UE in Youtube about programming in C++. In the 11th video entitled : Setting Up the Battery’s Construction Script, there’s a part (at 1:15) where the tutor called a function GetPlayerCharacter in the construction script blueprint of BP_BatterPickup. This function no longer exist in UE 4.11 and can only be called in the event graph.

Is this true or am I doing something wrong?

Is there an alternate function for this?

Or is that function now intended to be only in the event graph?


ACharacter* UGameplayStatics::GetPlayerCharacter(UObject* WorldContextObject, int32 PlayerIndex)
{
	APlayerController* PC = GetPlayerController(WorldContextObject, PlayerIndex);
	return PC ? Cast<ACharacter>(PC->GetPawn()) : nullptr;
}

This is found in GameplayStatics.cpp