Hello,
I have 2 scenes. Scene1 has two texboxes, to display the score and video title. I am storing the text of these two in two different variables. I tried passing on the score to the next scene using playerprefs and it works, same code when I am using with different directory name for the other variable i get the following error in console:
NullReferenceException: Object reference not set to an instance of an object
Scorecontrol.Start () (at Assets/Scripts/Scorecontrol.cs:15)
I am basically passing on the score and the video title along with other details filled in the by the user on the Scene 2 as an email. Is it possible to use playerpref to pass on more than one variable between scenes.I dont have much idea about playerprefs.
here’s my code for saving the values of the variables in scene 1:
PlayerPrefs.SetString(“CurrentScore”, scoreText.text);
PlayerPrefs.SetString(“VideoTitle”, Vidtitle.text);
and this is for getting the values in the Scene2:
scoretext2.text = PlayerPrefs.GetString(“CurrentScore”);
vtitle.text = PlayerPrefs.GetString(“VideoTitle”);
I get the error for the second line.