JetBrains / JetBrains/resharper-unity

Check validity of key code strings

Open
#123 4 comments 0 reactions 1 assignee Claimed by @citizenmatt View on GitHub
Dominant language
C#
Stars
1.2k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

When I'm done there will be no more stringly-typed methods left

There exists a simple mapping between the `KeyCode` enum and string representations used by the InputManager, [the pattern for which is listed in the Unity Manual](https://docs.unity3d.com/Manual/ConventionalGameInput.html). It would be great if the plugin could check for a valid string literal and provide a migration path to the more strongly typed overload which takes a `KeyCode` instead of a `string`.

- [`GetKey`](https://docs.unity3d.com/ScriptReference/Input.GetKey.html)
- [`GetKeyDown`](https://docs.unity3d.com/ScriptReference/Input.GetKeyDown.html)
- [`GetKeyUp`](https://docs.unity3d.com/ScriptReference/Input.GetKeyUp.html): Take a [string representing a key](https://docs.unity3d.com/Manual/ConventionalGameInput.html).

Sister Issue: #134 for virtual buttons/axis.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.