Question by
xxxevil · Feb 29, 2016 at 11:49 AM ·
stringinputfieldnull
received string from inputfield appearing as null from other scene
hi im really new to c# and unity and was hoping for some assistance
I'm doing small project and most of it is done, except sending the name from input field to a text label on another scene. i can already send string and int to my online scoreboard but im having a bit of trouble trying to convert the input-field to string and send it to another scene.
basically my code still considers it null even though something is received
here is my code for scene 1
[SerializeField]
public string user;
public InputField mainInputField;
public void GetInput(string user){
DontDestroyOnLoad (this);
mainInputField.text = user;
DontDestroyOnLoad(transform.gameObject);
}
my code for scene 2 to show within text label
public Text usermane;
private UIManagerScript manager;
manager = FindObjectOfType <UIManagerScript>();
void Start() {
manager = FindObjectOfType <UIManagerScript>();
}
void Update () {
usermane.text = "Username: "+ manager.mainInputField;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612065850im_/https://answers.unity.com/themes/thub/images/avi.jpg)