说明
- 删除特定key,场景中创建一个空object,改名,选中,执行菜单即可。不懂的看代码。
代码
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace DC
{
public class PlayerPrefsEditor : EditorWindow
{
[MenuItem("DC/PlayerPrefs/DeleteAll")]
public static void DeleteAll()
{
PlayerPrefs.DeleteAll();
PlayerPrefs.Save();
}
[MenuItem("DC/PlayerPrefs/DeleteTarget")]
public static void DeleteTarget()
{
PlayerPrefs.DeleteKey(Selection.activeGameObject.name);
PlayerPrefs.Save();
}
}
}