hey guys, i’ve started using playerprefs and want to know if theres a better way to access another scripts var without using the static function? both the scripts are in diffent scenes too btw
Static variables are often the easiest way to go about this but it depends on what you need to do. They allow data to be shared between scenes but they don’t store the data persistently like PlayerPrefs.
EDIT: missed the “different scenes” part; I’m not sure. I think you need to call DontDestroyOnLoad on the objects you want to grab variables from (or put the variables onto some other object that can be persisted between scenes)