Wanted to enable the console in a packaged shipping build.
Alas, there is a slight bug that prevents this (easily).
It should be as simple as changing the ALLOW_CONSOLE definition in Build.h.
Unfortunately,in the two console related functions in PlayerController.cpp, !UE_BUILD_SHIPPING is used instead.
I’ve created a Pull Request to fix that which you can find here.
For everyone else, you can just do the following:
\Engine\Source\Runtime\Core\Public\Misc\Build.h:
#elif UE_BUILD_SHIPPING
#if WITH_EDITOR
#define DO_GUARD_SLOW 0
#define DO_CHECK 1
#define STATS 1
#define ALLOW_DEBUG_FILES 1
#define ALLOW_CONSOLE 1
#define NO_LOGGING 0
#else
#define DO_GUARD_SLOW 0
#define DO_CHECK USE_CHECKS_IN_SHIPPING
#define STATS 0
#define ALLOW_DEBUG_FILES 0
#define ALLOW_CONSOLE 1
#define NO_LOGGING !USE_LOGGING_IN_SHIPPING
#endif
#else
\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:
void APlayerController::ConsoleKey(FKey Key)
{
#if ALLOW_CONSOLE
if (ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player))
{
if (LocalPlayer->ViewportClient && LocalPlayer->ViewportClient->ViewportConsole)
{
LocalPlayer->ViewportClient->ViewportConsole->InputKey(0, Key, IE_Pressed);
}
}
#endif // ALLOW_CONSOLE
}
void APlayerController::SendToConsole(const FString& Command)
{
#if ALLOW_CONSOLE
if (ULocalPlayer* LocalPlayer = Cast<ULocalPlayer>(Player))
{
if (LocalPlayer->ViewportClient && LocalPlayer->ViewportClient->ViewportConsole)
{
LocalPlayer->ViewportClient->ViewportConsole->ConsoleCommand(Command);
}
}
#endif // ALLOW_CONSOLE
}