How to reference a variable between scenes and scripts in c#

I’m trying display the score at the end of a simple game on a game over scene. I have two scripts: GameManager and GameOverManager, in GameManager, public Text score displays the score. I want to display that text on my GameOver scene, as public Text EndScore. All I want to do is set EndScore equal to score in my GameOverManager script so I can display it.

Hi dude!

AFAIK the only way you can do this is to create a gameObject attach the data you need to it and dont let it destroyed when load new scene by the Object.DontDestroyOnLoad function.

This way you will have a gameObject wich will stay when you switch scenes, so you can load data from and into it.

I hope i understanded your problem the right way, so i could help =)

Good luck finding the solution