Download

derived class of ULocalPlayer cast always returns null

I have just started diving into the Network side of UE4 and I am having an issue with my derived class of ULocalPlayer. Every-time I attempt to cast to it from inside a player controller the cast returns null. Example code below and any suggestions would be appreciated.

Edit: I also have tested casting with just ULocalPlayer and the cast does not return NULL.



void AMainMenuPlayerController::ShowMenu()
{


	UHeroLocalPlayer *lp = Cast<UHeroLocalPlayer>(Player);

	if (lp == NULL)
	{
		UE_LOG(NetworkLog, Warning, TEXT("Local Player is null "));
	}

	if (lp != NULL)
	{
		UE_LOG(NetworkLog, Warning, TEXT("Local Player is not null"));
		FInputModeUIOnly InputMode;
		SetInputMode(InputMode);
	//	lp->ShowMenu();
	}

}



I was able to resolve issue on my own. Just for reference if anyone else runs into this issue I forgot the call to super::PlayerAdded