How can i ask a user for their name?

hello,

i am working on a very small memory game, now i want to, for every player, save their name and time taken. i’ve figured out the time part but i cant figure out how to ask the user for a name.


InvalidProgramException: Invalid IL code in Microsoft.VisualBasic.Interaction:InputBox (string,string,string,int,int): IL_0000: ret

GameController.init () (at Assets/GameController.cs:39)
GameController.Start () (at Assets/GameController.cs:34)


Any help is appreciated.

It’s really hard to get any sense without knowing what you’re trying. Can you share your code? More than likely, you’ll have to collect this data with Unity UI objects.

To start, go to GameObject → UI → Input Field. This will insert an editable textbox in your scene, that users can type in. After that, just hook up your scripts to read this value, and you should be good to go.