Setting navigation option to None does not help.
Double post: How to disable keyboard navigation? - Unity Engine - Unity Discussions (answer provided there. =))
That answer does not help me. We can’t simply clean fields in Standalone Input Module. If we do this, ui will be broken and a lot of errors appear. I cant set them to null, or to anything except Horizontal etc. Deleting EventSystem does not help too.
Try:
EventSystemManager.currentSystem.currentInputModule.DeactivateModule();
This does not help too. If i do this in Start method, Null reference exception throwed. When i execute it Update, UI deactivates completely and when i press any button, Null reference exception throwed again. Currently for me its very weird behavior. May be it is navigation bug or something similar?
The inbuilt input module is designed to work with keyboard input. If you want to not have keyboard input you can either modify the existing StandalonInputModule or write a custom module that does not support keyboards.
Is standart module similar to b20 · GitHub?
Anyway i cant get it work, because of missing script error after i set this script instead of builtin. Would you be so kind to provide an example?
Not the cleanest way, but it works:
I just derived StandaloneInputModule and removed Keyboard stuff from Process method
Yes, this script solve the problem, thank you.
defaxer’s NoKeyboardInputModule.cs script was working for me (thanks!), but broke when I updated to beta 19.
Stupid question, but I’m not sure how to view the current StandaloneInputModule.cs so that I can derive/override its functionality.
Bump. Where i can get b20 version of StandaloneInputModule.cs. Too many undocumented changes, I can’t fix previous module.
I may be wrong, but you have to change:
var pointerData = GetMousePointerEventData();
with
var pointerData = GetMousePointerEventData()[PointerEventData.InputButton.Left].buttonData;
in ProcessMouseEvent method() (Line 28)
the interactable check box also seems to work?
or maybe not… just lost focus i guess idk
I finally found out how to disable keyboard interaction in beta 20 without writing your own input module (to replace StandaloneInputModule).
You have to uncheck the “Send Navigation Events” checkbox on the Event System component of your EventSystem scene object.
For what it’s worth, before I found this solution, I found out how to view StandaloneInputModule.cs. In MonoDevelop, you can have to navigate to UnityEngine.UI.dll from the Solution browser (typically it’s under Assembly-CSharp → References). Viewing UnityEngine.UI.dll in the Assembly Browser, you can navigate to UnityEngine.UI → UnityEngine.EventSystems → StandaloneInputModule. Using this source, I wrote a new “no keyboard” input module similar to defaxer’s (upthread) and it seemed to work (even though I was way out of my depth). But I’m much more comfortable with the simpler solution above.
That’s the solution I stumbled over as well. According to the docs, it’s exactly what that field is there for. (See Send Navigation Events.)
It can be toggled via script like so:
UnityEngine.EventSystems.EventSystem.current.sendNavigationEvents = !UnityEngine.EventSystems.EventSystem.current.sendNavigationEvents;
Here is an update Version of the Mouse Only Input Script
2387869–162596–MouseOnlyControls.cs (5.44 KB)
Is it not enough to to simply disable the “Send Navigation Events” on the Event System manager component?