I’m trying to use a text to store a character name from an input field. Problem being these are both in different scenes. So I’m looking for a solution, I’ve read about Object.DontDestroyOnLoad. Unfortunately I haven’t been able to get this to work.
While there are a lot of ways to do this, you could just store the name in a playerpref from the first scene and then load it up in the second scene. Pretty simple way of doing it.
Thank you for replying, I will try this and get back to you.
Alright, so here is what I’ve got. So far I’ve managed to store the data but I cannot access it from the 2nd script.


Sorry about all this, I’m very new to unity.
string playerName = PlayerPref.GetString(samestringasIusedbefore);
May want to brush up on tutorials if this trips you up. Your SetString takes a key and a value. The first string you have as a public variable, so you probably typed something into the inspector. Your second script needs to use that same string. So you either make a public variable there as well with the same string assigned to the variable, or you hardcode the value in. The second script can’t access the first scripts variables like that.
