So I have something like this:
//more GUILayout functions above...
enteredText = GUILayout.TextField(enteredText);
//... and more GUILayout functions below
What I want is for the text field to always be selected (hence the immediate focus control). Above this there is a section with changing layouts, which causes the text field to become unselected. When GUI.FocusControl() is in there, it maintains control of the text field, but it always selects ALL of the text any time there is a change above. If I'm typing something when it does this, it immediately deletes everything in the field.
My main question is, how do I keep focus on the text field without selecting all the text every time the layout changes? Is there a better way to handle this?
Answer by fabr.IQ
Feb 25, 2013 at 08:40 PM
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
10 People are following this question.
How to make camera position relative to a specific target.
Get height of a group of GUILayout controls
GUILayout Draggable Window
Android/IOS First Person Shooter
GUI focus and draw order mixed