Disabling Input Code Location Question

In “Handling Pawn Death”, we insert this code into our ToonTanksGameMode.cpp function:


if (Tank->GetTankPlayerController())
		{
			Tank->DisableInput(Tank->GetTankPlayerController());
			Tank->GetTankPlayerController()->bShowMouseCursor = false;
		}

Is there any particular reason we didn’t place this code in the HandleDestruction function? To me it makes more sense, since that code involves rendering the tank inaccessible to the player:

Super::HandleDestruction();
SetActorHiddenInGame(true);
SetActorTickEnabled(false);

//Below code was in "ToonTanksGameMode.cpp"
if (GetTankPlayerController())
{
	DisableInput(GetTankPlayerController());
	GetTankPlayerController()->bShowMouseCursor = false;
}

What you suggest makes sense to me.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms