- Home /
How to I allow a user to enter their name in a text box and show it in another level?
I've just started learning how to code and i'm making an options scene. I want the player to enter their name into to some sort of text box and then show it when they finish the game in another scene. Please help and dumb it down for me, thank you
Comment
Answer by tanoshimi · Dec 10, 2013 at 07:16 PM
To let the user enter their name and store it in a variable, use a GUI TextField.
Variables are normally attached to instances of gameobjects, which are destroyed when a new scene is loaded. To prevent this from happening, you can store the player's name as a variable on an object marked with DontDestroyOnLoad.
There's code examples on both the reference pages linked.