I'm working on a chat GUI at the moment and I stumbled across an interesting issue that I haven't been able to figure out. If I use am searching for a particular string and replacing with something else, the cursor stay at the previous location in the string. For example:
The resulting cursor position will be (pipe as the cursor position) [/Sq|uad ]
I've tried using chatEntryValue.Remove(1,1) & chatEntryValue.Insert(1,"Squad ") with the same results and even gone so far as unfocusing off the TextField and containing window and refocusing.
Does anyone out there know of a way to move the cursor to the end of the TextField? I'd even settle for simulating Right arrow key presses on the keyboard.
Looking around, unfortunately there is no way to move the text cursor around inside a Text Area or Textbox. You can get the current position of the cursor, but you cannot set it.
I would suggest this feature be added using the "Report bug" feature inside of Unity. There is an option there for suggesting new features.
And, perhaps, this functionality has been added in Unity 3, which is due out any time now. You could always wait and see if they've included it in there or not. As of right now, though, it looks like this isn't possible.
So Unity3D 3 is out since a while. Did something change regarding this problem? I've examined the whole scripting-reference but unfortunately found nothing.