private static string DoTextField(string text, int maxLength, bool multiline, GUIStyle style, GUILayoutOption[] options) { int controlID = GUIUtility.GetControlID(FocusType.Keyboard); GUIContent gUIContent = GUIContent.Temp(text); if (GUIUtility.keyboardControl != controlID) { gUIContent = GUIContent.Temp(text); } else { gUIContent = GUIContent.Temp(text + Input.compositionString); } Rect rect = GUILayoutUtility.GetRect(gUIContent, style, options); if (GUIUtility.keyboardControl == controlID) { gUIContent = GUIContent.Temp(text); } GUI.DoTextField(rect, controlID, gUIContent, multiline, maxLength, style); return(gUIContent.text); }
static string DoTextField(string text, int maxLength, bool multiline, GUIStyle style, GUILayoutOption[] options) { int id = GUIUtility.GetControlID(FocusType.Keyboard); GUIContent content = GUIContent.Temp(text); Rect r; if (GUIUtility.keyboardControl != id) { content = GUIContent.Temp(text); } else { content = GUIContent.Temp(text + GUIUtility.compositionString); } r = GUILayoutUtility.GetRect(content, style, options); if (GUIUtility.keyboardControl == id) { content = GUIContent.Temp(text); } GUI.DoTextField(r, id, content, multiline, maxLength, style); return(content.text); }