[Help] Get Player's name?

So I am currently working on my own story and I want to make the experience more engaging by having players input their names and later call it in another state but I can’t seem to be able to do that. a little help?

Hi Kevin,

Great idea.

You may want to take a look at the UI.InputField control. Perhaps you could have a scene prior to the main story scene when you ask for the player’s name using this control, e.g. start simple. All you need to do then is store the value so you can use it later.

You could create a separate player class perhaps, add a variable to store the player’s name etc, you could also consider using PlayerPrefs, you come on to using these later in the course, it’s a way of storing some player data.

As with all things, many ways to approach the task. So as not to break anything you are already working on you could always consider creating a separate project to just handle the input and storage, either via another class or the player prefs and see if you can return it on a second scene. If you can, then implement your solution into your existing game.

Hope this helps :slight_smile:


See also;

Privacy & Terms