InputField in a different scene to Text

Hey, sorry if there is a simple answer to my question, I’m a beginner in unity XD Im using 5.3. I have an InputField in my main menu scene, and in another scene I have a text gameobject which displays the InputField text… I have added a javascript to my InputField (in my main menu scene):

 var username : String;
 var inputField : UnityEngine.UI.InputField;
 var nameDisplay : UnityEngine.GUIText;
 
 function NameInput () {
    username = inputField.text;
    nameDisplay.text = username;
    inputField.enabled = false;
 }

Since my InputField and my Text gameobject are in separate scenes, how do I assign this variable? Thanks, Sam :wink:
PS: What I’m trying to make is a username system similar to agar.io and slither.io where you enter your username in an inputfield in the main menu, and it appears above your player in the game scene.

I would use PlayerPrefs and more specifically, PlayerPrefs.SetString. So in your first scene before you enter the next scene you can save your name using something like…

PlayerPrefs.SetString("Username", inputField.text);

…where “inputField” is your username field. Then in the next scene, you can load the username variable and apply it to your text object by doing something like…

playerName.text = PlayerPrefs.GetString("Username");

…where playerName is your text object.

Hope this helped you! :slight_smile: