Expect to see this error a LOT. It’s easily the most common thing to do when working. Learn how to fix it rapidly. It’s easy. See the above link for more tips.
You need to figure out HOW that variable is supposed to get its initial value. There are many ways in Unity. In order of likelihood, it might be ONE of the following:
drag it in using the inspector
code inside this script initializes it
some OTHER external code initializes it
? something else?
This is the kind of mindset and thinking process you need to bring to this problem:
So, I read through the PLBM (what do these letters stand for anyway ?) page, and I was able to preserve the playerName variable by making it a child of the empty gameObj., which has a DontDestroyOnLoad function on it. However the game displays a “technical” name instead. If I try to follow the guide that you linked, I think my problem is in the “why is it not being set up?” step.
I suppose I need to rearrange my name displaying code, but I don’t know how:
Be sure to reason about what is the score (numeric) and what is the presentation text.
That name tells you what it is: you are printing an object of type UnityEngine.UI.Text
Do you perhaps instead mean to print the .text field of that object?
But even that seems weird: you probably want to be using the same approach that you use to make "Score: 0" and instead make "Best Score: 0" for your top score.
The way you are going at it above, it is going to read:
It was a lot of trouble because I would lose motivation from time to time and was also busy IRL, but I completed the Scene Flow and Data Persistence tutorial ! It took me almost 4 months, but I did it damn it !
Data persistence between scenes (1 of 2). This video was particularly useful: