Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

[Problem] Use Playerpref.GetInt in other thread

$
0
0
Hi! i'm having a problem using playerpref.getint in other thread created in the game. i have been trying ways of us playpref.getint in other thread for more than 8 hours. i'm doing this: Thread t = new Thread(ScoresOnline); t.Start(); and this: void ScoresOnline(){ int bestSctore = PlayerPrefs.GetInt("Score") scoreBoard.SaveScore(bestSctore); (...) } Im getting this error: GetInt can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function. Please anything that could help, would be great, i have already tried a lot of things, but not the right one. So, can you help me?

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>