Skip to content

Keyboard key icon is incorrect on non-US keyboards #5

@lgarczyn

Description

@lgarczyn

Hello, it appears that the package will insert the wrong sprite on any non-QWERTY keyboard, which are very common, notably in france.

This is due to using the raw bindingPath, instead of using Key.displayName for keyboards

Because the keyboard layout can change at any point, I think it would be wise to replace the ActionBindingMapEntry system

 var entry = new ActionBindingMapEntry
                        {
                            BindingPath = binding.path,
                            IsComposite = binding.isComposite,
                            IsPartOfComposite = binding.isPartOfComposite
                        };

Instead of creating new classes, s_actionBindingMap could simply be a list of InputBindings

Then instead of using InputBinding.path, a better solution would be to use effectivePath, to account for any local overrides.

                        string effectivePath = binding.effectivePath;
                        bool isKeyboard = effectivePath.StartsWith("<Keyboard>/");
                        if (isKeyboard)
                        {
                            string keyName = bindingPath["<Keyboard>/".Length..];
                            InputControl key = Keyboard.current[keyName];
                            string physicalKeyName = key.displayName;
                            effectivePath = $"<Keyboard>/{physicalKeyName}";
                        }

And then apply the normal lookup using the modified effectivePath.

Is there any reason for keeping a local list instead of simply referencing the unity data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions