Im trying to get the high score to show on the main menu of my game, but it says that it needs an object reference.
Im using this
score = nhs.highScore;
but it says it. please help
(C# and i did set a variable so I can use stuff from the script)
There’s probably more ways than what I’m listing here
-
DontDestroyOnLoad() will preserve an object during level loading call.
-
Using static variables will not change the variable during level loads.
-
Using PlayerPrefs, I don’t feel this an appropriate use for PlayerPrefs, but some people might say otherwise. It will work though.
-
Storing the data in a local file or uploaded to a server. This is probably overkill, but it would still work.