How to keep variables throught scenes?

I mean, if i have a float var in a gameobject, but i need to keep the value of it in another scene? I have to make it a global variable, or to save it in an external doc?
Thank you!

You could use static variables or PlayerPrefs.

A static will persist for the duration of a play session, while PlayerPrefs can save/load across play sessions.