- Home /
TextField/User Controls Conflicts
Well I have a textfiled and I want to make it so when you left click the text field, W A S and D will disable. Up until reccently I just had an enter key toggle, but now the guys say they want the chat textfield and chat log to always be visible, and it looks really dumb when you start to walk around while typing, so I figure there has to be a way to detect if you are typing in a textfield?
Answer by JonManatee · Jun 12, 2010 at 07:54 PM
I believe you are interested in the focus controls for GUIs, check out:
http://unity3d.com/support/documentation/ScriptReference/GUI.GetNameOfFocusedControl.html
and
http://unity3d.com/support/documentation/ScriptReference/GUI.FocusControl.html
Answer by Jerad · Jun 13, 2010 at 04:26 PM
Yeah that's what I tried originally but I eventually gave up, I probably just over looked some important detail of how it was suppose to work (like GUI.SetNextControlName (""); and GUI.FocusControl (""); needed to be in the same function or something). In the end I just created a rect that detected collisions, then made it so if you clicked while inside the rect the game assumed the check box click, and if you clicked outside of it I just made it so any key presses wouldn't write to the display string.