I've left high score name entry until near the end of the game as I don't quite know what to do. Maybe I read something wrong that is clouding my mind, anyway...
I have my main game game loop code that calls a HighScore () function to check if a high score has been achieved, updates the appropriate variables then goes to the Main Menu.
Currently I just have it make the player name for the score "New Score" as a placeholder.
How do I do the name entry (iPhone and Mac options)? My guess is Instantiate a new empty object that has a script calling OnGUI (something I don't use at the moment, only GUIText), that changes a nameEntry var so that I can continue my high score table updates.
I'm unsure of how to do the name entry correctly (something about OnGUI updating several times a second renewing the entry field? Is that right? maybe where I got lost).
And how do I stop the HighScore () function from continuing until I have got the name entry completed?
You use coroutines for scheduling events:
In practice, the functions would probably be in other scripts, so you'd have to get appropriate references first and use them. (i.e., "
You can use GUI.TextField for name entry. The script, which should be disabled by default so OnGUI doesn't run until needed, could be something like