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

problem incrementing player prefs

$
0
0
in my game i want the player taking screenshots of the game. Am using playerprefs to save number of screenshots so i can have screen-1,screen-2 screen-3 etc the problem is it does not increment above 1 and i don't know why here is my code function Awake() { if(!PlayerPrefs.HasKey("HighScore")){ PlayerPrefs.SetInt("HighScore",0); } } function Encode{ Application.CaptureScreenshot( System.IO.Path.Combine( System.Environment.GetFolderPath( System.Environment.SpecialFolder.MyPictures ), "screen-" + PlayerPrefs.GetInt("HighScore") + ".png") ); yield WaitForSeconds(2); PlayerPrefs.SetInt("HighScore",(PlayerPrefs.GetInt("Highscore")+1 )); } thanks for any help

Viewing all articles
Browse latest Browse all 1333

Trending Articles



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