in 5.7 the assumption to use the first local player’s enhanced input subsystem for debug was removed by getting the targeted pawn from the HUD. This expansion in functionality is very welcome but perhaps has introduced a regression, we used the enhanced input debug in our frontend - where we have no pawn.
I’m wondering if there’s a different tool that we should use in this scenario or if falling back to the old behaviour is a reasonable expectation.
if (HUD->ShouldDisplayDebug(NAME_EnhancedInput))
{
FDisplayDebugManager& DisplayDebugManager = Canvas->DisplayDebugManager;
DisplayDebugManager.SetFont(GEngine->GetSmallFont());
DisplayDebugManager.SetDrawColor(FColor::Yellow);
DisplayDebugManager.DrawString(TEXT("ENHANCED INPUT"));
bool bFoundValidDebugTarget = false;
// Checking if the debug target actor is a valid local player, if so then show their debug info
// If target actor is not a local player then don't display anything
if (APawn* TargetPawn = Cast<APawn>(HUD->GetCurrentDebugTargetActor()))
{
if (APlayerController* PlayerController = Cast<APlayerController>(TargetPawn->GetController()))
{
if (const ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(PlayerController->Player))
{
if (UEnhancedInputLocalPlayerSubsystem* EnhancedInputSubsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(LocalPlayer))
{
EnhancedInputSubsystem->ShowDebugInfo(Canvas);
bFoundValidDebugTarget = true;
}
}
}
}
if(!bFoundValidDebugTarget)
{
DisplayDebugManager.SetDrawColor(FColor::Red);
DisplayDebugManager.DrawString(TEXT("Debug Target is not valid for Enhanced Input Debug Display"));
//begin - fallback to the old behaviour if we can't find the subsystem
TObjectIterator<UEnhancedInputLocalPlayerSubsystem> FirstPlayer;
if (FirstPlayer)
{
FirstPlayer->ShowDebugInfo(Canvas);
}
//end - fallback to the old behaviour if we can't find the subsystem
}
}
Looking forwards to your advice in this matter.
[Attachment Removed]