Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: ninuson on October 13, 2014, 08:56:29 PM
-
Hi,
First of all, thanks for a wonderful package! I've been working with it for a while and both the number of features and the support are outstanding.
I ran into something I couldn't find either on the forums or figure out myself. I mix both Unity's native input system and NGUI. I know that it's not ideal and hopefully will refactor everything to NGUI eventually, but I would prefer to solve this problem regardless.
To my problem: I have some things key bound to happen when Input.GetKey(KeyCode.Return) is happening. Specifically, it activates the chat logic. My problem is that if I have clicked on any of the NGUI buttons on the GUI, hitting enter will also click that button. I did not define a behavior for when a key is pressed on the NGUI side for any of the buttons and I don't have an OnSubmit() or KeyBind scripts attached to anything. This sort of leads me to believe it's some default behavior I'm simply not aware of...
I have also tried to play around with UIInput but I wasn't sure how to clear the current "focus". Help would be appreciated!
-
This happens because when you touch something with NGUI, it gains selection. Selected objects receive keyboard and navigation events, and Return key is one of them.
UICamera.selectedObject = null;