UnrealImGui icon indicating copy to clipboard operation
UnrealImGui copied to clipboard

ToggleInput keybind does not work unless plugin settings are changed after PIE has been already started once

Open doanamo opened this issue 1 year ago • 2 comments

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.

doanamo avatar Dec 28 '23 00:12 doanamo

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.

doanamo avatar Dec 28 '23 00:12 doanamo

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.

focusright avatar Feb 09 '24 00:02 focusright

This should be properly fixed in 633e3eb56d141805eedb62ce69afe5cc56a0dec6.

jonpas avatar Jul 03 '24 14:07 jonpas