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.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
To help users post good questions and use the site effectively we have posted a user guide. Please check it out.
Answers and Comments
10 People are following this question.
How to make camera position relative to a specific target.
For Loop GUILayout.Label Problems
Is there a method for getting Scrollview to work in a GUILayout Window?
Grid of GUILayout buttons?
How do I draw controls in a GUI Window - based on screen dimensions?