IDI-Systems / UnrealImGui

Unreal plug-in that integrates Dear ImGui framework into Unreal Engine 4/5.
MIT License
121 stars 27 forks source link

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

Closed doanamo closed 2 days ago

doanamo commented 6 months ago

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 commented 6 months ago

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.

focusright commented 4 months ago

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.

jonpas commented 2 days ago

This should be properly fixed in 633e3eb56d141805eedb62ce69afe5cc56a0dec6.