UnrealImGui
UnrealImGui copied to clipboard
ToggleInput keybind does not work unless plugin settings are changed after PIE has been already started once
It seems that ToggleInput binding added in this code does not carry over to future PIE instances (if none have been started yet):
if (UPlayerInput* DefaultPlayerInput = GetMutableDefault<UPlayerInput>())
{
UpdatePlayerInput(DefaultPlayerInput, KeyBind);
}
Tested in Unreal Engine 5.3.2 - this is an issue in editor and also standalone game.
Looks like replacing GetMutableDefault<UPlayerInput>()
with GetMutableDefault<UEnhancedPlayerInput>()
in aforementioned code (after adding appropriate dependencies) fixes the issue. I guess this issue has started occuring after UE transitioned to using EnhancedInput by default? For backward compatibility, defaults should be modified for both classes.
Besides the above mentioned, you also have to add this into ImGui.uplugin
"Plugins": [
{
"Name": "EnhancedInput",
"Enabled": true
}
]
"EnhancedInput" into Source/ImGui/ImGui.Build.cs
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"InputCore",
"Slate",
"SlateCore",
"EnhancedInput",
}
);
and include at the top of Source/ImGui/Private/Utilities/DebugExecBindings.cpp
#include "EnhancedPlayerInput.h"
This is done in this pull request.
This should be properly fixed in 633e3eb56d141805eedb62ce69afe5cc56a0dec6.