Advertisement
kasru

Saving / Loading

Jan 16th, 2013
5,648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //****** Donations are greatly appreciated.  ******
  2. //****** You can donate directly to Jesse through paypal at  https://www.paypal.me/JEtzler   ******
  3.  
  4. var saving : boolean = true;
  5.  
  6. function Start() {
  7.  
  8.     OnLoad();
  9.     autoSaveEnable();
  10. }
  11.  
  12. function autoSaveEnable() {
  13.  
  14.     while(saving) {
  15.         yield WaitForSeconds(5);
  16.         Debug.Log("save me");
  17.         OnSave();
  18.     }
  19. }
  20.  
  21. function OnSave() {
  22.  
  23.     PlayerPrefs.SetInt("CurXp", playerHealth.curXp);
  24. }
  25.  
  26. function OnLoad() {
  27.  
  28.     Debug.Log("loaded");
  29.     playerHealth.curXp = PlayerPrefs.GetInt("CurXp");
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement