psydack / uimgui

UImGui (Unity ImGui) is an UPM package for the immediate mode GUI library using ImGui.NET. This project is based on RG.ImGui project.
MIT License
343 stars 53 forks source link

Input System not working as expected #39

Closed PerfectlyFineCode closed 11 months ago

PerfectlyFineCode commented 2 years ago

Unity version: Unity 2021.2.19f1 Input System Version: 1.3.0 UIMGUI Version: 4.1.1

Reproduction steps: Set platform type to 'Input System' and start the game.

KeyNotFoundException: Cannot find control '#(a)' as child of 'Keyboard:/Keyboard'
UnityEngine.InputSystem.InputControl.get_Item (System.String path) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Controls/InputControl.cs:417)
UImGui.Platform.InputSystemPlatform.SetupKeyboard (ImGuiNET.ImGuiIOPtr io, UnityEngine.InputSystem.Keyboard keyboard) (at Library/PackageCache/com.psydack.uimgui@1957436cf8/Source/Platform/InputSystemPlatform.cs:132)
UImGui.Platform.InputSystemPlatform.Initialize (ImGuiNET.ImGuiIOPtr io, UImGui.UIOConfig config, System.String platformName) (at Library/PackageCache/com.psydack.uimgui@1957436cf8/Source/Platform/InputSystemPlatform.cs:46)
UImGui.UImGui.SetPlatform (UImGui.Platform.IPlatform platform, ImGuiNET.ImGuiIOPtr io) (at Library/PackageCache/com.psydack.uimgui@1957436cf8/Source/UImGui.cs:294)
UImGui.UImGui.OnEnable () (at Library/PackageCache/com.psydack.uimgui@1957436cf8/Source/UImGui.cs:177)
simeonradivoev commented 1 year ago

This can easily be fixed using the FindKeyOnCurrentKeyboardLayout in InputSystemPlatform/SetupKeyboard instead of the array accessor.

simeonradivoev commented 1 year ago

but also make sure to keep in mind that FindKeyOnCurrentKeyboardLayout can return null if the language is different. It's not asking for the physical key location unless there is a way to do that as well.