Hello Unity masters !
I am nearly done with my web project but only one thing still bother me.
When I ask the player to type his name for the scoreboard, a textfield shows up.
I use the GUI.FocusControl to focus on the textfield to avoid the player to click in the textfield.
Here is the code :
function OnGUI ()
{
if (dispNameInput)
{
// Set the internal name of the textfield
GUI.SetNextControlName ("MyTextField");
// Make the actual text field.
curName = GUILayout.TextField (curName.ToUpper(),9);// Got ot put the string variable before to have the textfield editable (typable)
if (focusOnplayerName)
{
focusOnplayerName = false;
GUI.FocusControl ("MyTextField"); // focus on input player name
}
}
}
When I do a webplayer build and open the html file to test it, the focus is PERFECTLY done.
But when I put the same files on my website and test it, the focus is NOT done. And above all, when the player type his name, sometimes, the typing get stuck.
You can try the game if you want to test :
(when you lose, the game ask for saving the score. choose “yes” to see the problem with player’s name texfield)
Thanks for your help.