Download

Get Controller using a static function

Hi,
As the subject says, I tried to implement but get a nasty crash. Here is the current code:-



float USimBlueprintFunctionLibrary::GetVehicleBrake()
{
	if (GEngine && GEngine->GetWorld()) {
		APlayerController* controller = UGameplayStatics::GetPlayerController(GEngine->GetWorld(), 0);
	}
        return 0;
}


Yes it is a BluePrint function library.
Is there other way?

Anyone know out there? There must be a way…

you can use this
GEngine->GetWorld()->GetFirstPlayerController()