When building an android version of my game i have some problems with my textfields.
When going from one textfield to an other, the 2nd textfield copies the content of the first.
They are created like this:
user_name = GUI.TextField(new Rect(wi2, hi8.1f, Screen.width-(wi4), hi2), user_name, 25,maingui.GetStyle(“textfield”) );
user_email = GUI.TextField(new Rect(wi2, hi11.35f, Screen.width-(wi4), hi2), user_email, 25,maingui.GetStyle(“textfield”) );
is there anything i am missing?
Well, the problem is that Unity uses an internal “TextfieldEditor” class. This is some kind of singleton. There is only one instance since it can only be one active TextField. Usually Unity detects when you click on another field and reinitialize the editor for the new field. I don’t develop for iOS, so i can’t test it, but maybe you can force a switch by resetting hotControl and keyboardControl when you want to switch.
Btw: If you have set your maingui skin as default skin:
GUI.skin = maingui;
You can just use the style name:
user_name = GUI.TextField(/* ... */, user_name, 25, "textfield");
If you use multiple skins at the same time, you would have to switch the skin every time, which is not very effective.