Skip to content

Quick Delete PlayerPrefs with Menu Button

Here’s a quick script I made to save myself some time.

PlayerPrefs is an excellent tool for saving small pieces of game data such as settings, preferences, and launch counts. However, debugging PlayerPrefs can be a hassle without a method for quickly deleting (or restoring) them.

Deleting them directly can be quite a hassle. It requires delving deep into the folder structure to find the file to delete or creating an ugly temporary debug button. Instead, you can use this script to create a menu item and you’ll be able to delete the PlayerPrefs at any time.

using UnityEngine;
using UnityEditor;

public class DeletePlayerPrefsScript : EditorWindow
{
    [MenuItem("Window/Delete PlayerPrefs (All)")]
    static void DeleteAllPlayerPrefs()
    {
        PlayerPrefs.DeleteAll();
    }
}
Published inCode Examples

Be First to Comment

    Leave a Reply