Skip to content

Conversation

timbo-tj
Copy link

Support for new Input System (inc. Enhanced Touch) while maintaining backwards compatibility with legacy Input Manager.

Some notes:

  • Backwards compatible, the new Input System logic is wrapped in #if ENABLE_INPUT_SYSTEM which means this should work in projects that are using the legacy Input Manager. (Tested)
  • I did not test my changes on iOS yet, though I did not touch much iOS specific code.
  • Instead of 'on touch DOWN' I changed some of the checks to 'on touch UP' (ie, to dismiss the keyboard with a tap). The users intent isn't clear yet when they press down on the screen, so we wait until they actually tap the screen to dismiss the keyboard. The old behavior was causing a pre-emptive dismissal when the user tries to dismiss the keyboard via 'android back' (back gesture)... and that leads me to:
  • Android 'Back' will now dismiss keyboard if IsManualHideControl is disabled.
  • There was a bug here that I have fixed since I was touching that code anyway. It was passing in the whole input string instead of the current char. https://github.com/mopsicus/umi/blob/ba206bad1ca37892dadebc89dc9274135771f8c2/Runtime/MobileInputField.cs#L835C40-L835C41
  • The built in sample is built for the old Input Manager and wont work out of the box if you try it in a project that is configured to use the new Input System. You need to replace the script on the EventSystem object in the example scenes with the new Input System compatible one. Maybe the main Sample should be updated to expect/assume the new Input System being used, and we can provide a legacy Sample that uses the old Input Manager. Though its 2025, we could probably go without the Legacy sample (less busy work for maintainers) and just note somewhere on the docs that this package is compatible with the legacy Input Manager. Happy to update the sample scenes if you'd like to bring this package into the 'modern era' and make the new Input System the expected one.

Some unsolicited feedback:

  • The heavy use of preprocessor directives make it really hard to work with this code. A lot of logic is wrapped in #if !UNITY_EDITOR and, well, my development environment is never not editor. So I lose all code completions/intelisense. I tried my best to replicate the repositories style and was liberal with my use of preprocessor directives as well, but it made it really hard to contribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant