(转)PlayerPrefs在Windows下存到哪里去了?

自:http://www.unitymanual.com/blog-77510-2971.html?_dsign=ec64b1e5

 

测试脚本  saveData.cs 附着在MainCamera上。

[code]csharpcode:

using UnityEngine;

using System.Collections;

public class saveData : MonoBehaviour

{

 private string name="None";

 private int age=0;

 void Start()

 {

  Debug.Log("defalut value: name="+name+",age="+age);

 }



 void OnGUI()

 {

  if(GUI.Button(new Rect(20,40,40,20),"save"))

  {

   PlayerPrefs.SetString("Name","Kitty");

   PlayerPrefs.SetInt("Age",2);



   name=PlayerPrefs.GetString("Name");

   age=PlayerPrefs.GetInt("Age");

   Debug.Log("changed value: name="+name+",age="+age);

  }

 }

}

 

点击save按钮之后两个变量的值被改变并保存。

PlayerPrefs所存的数据在注册表中以图中4所在的名字文件下

运行----regedit( 打开注册表)  HKEY_CURRENT_USER/software下

posted @ 2015-06-29 10:25  ☆A希亿  阅读(832)  评论(0编辑  收藏  举报