LoginSignup
10
4

More than 5 years have passed since last update.

Unity 2018.3からPlayerPrefsを全削除するメニューアイテムが標準で追加された

Posted at

Unity 2018.3から、PlayerPrefsを削除するメニューアイテムが、標準で追加されました。

次の画像のように、Edit > Clear All PlayerPrefsを選択すると、

ClearAllPlayerPrefs.PNG

次の画像のようなダイアログが出てきて、

dialog.PNG

Yesを押すと、PlayerPrefsの中身が削除されるようです。

便利!

ただ、この機能リリースノートに載っていない?

Unity 2018.2まではこんな感じでMenu ItemからPlayerPrefsを削除できるようにするコードを書いていた人も多いと思うけれど、このコードも必要なくなりました!


using UnityEngine;
using UnityEditor;

public class DeleteAllPlayerPrefs
{
    [MenuItem("Tools/DeleteAll PlayerPrefs")]
    public static void Execute()
    {
        PlayerPrefs.DeleteAll();
        Debug.Log("PlayerPrefs.DeleteAll()");
    }
}

やったね!

10
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
4