Hello!
I’m trying to do an ingame chat very similar to FPS games like Call of duty and Left for dead. Mouse is locked on the screen, you press a key that pops the chat text field with focus on it, write it, press enter and send it, the field disappears and the message appears on bottom of previous messages.
Ok, I have all that working but somehow when the previous messages disappear from screen, if you were writing on the text field all the text gets highlighted and if you keep writing you’ll obviously overwrite its extremely buggy. I know that somehow the text field loses focus and when i give the focus back to the text field all text gets automatically selected (I know that because I printed logs when that happened I’m switching focus back to the text field).
So, to my question: Is there a way to avoid that behavior? I need or for the text field not to lose focus when the something in the gui changes or when i give focus to the text field not to selected all text and set the cursor to the end of the string.
I found a workaround
. If i have my text field on a separated OnGUI apparently the text field does not lose the focus thus I don’t have to give the focus to it again
.