Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
13
Question by ruben_hiet · May 14, 2011 at 07:19 PM · playerprefs

Is there a simple way to delete all your playerprefs in the editor and webplayer?

Hej,

I am making a main menu for a game I don't have but just making it and now working on the settings page. Here you must change settings and apply them so you save them in your PlayerPrefs. So when you start up the next time you can use the same settings.

When I changed a lot of code in my scripts I want to see how it works from first startup so I have to delete all my PlayerPrefs but how can i do this fast? because now I am doing them 1 by 1 with this for example :

PlayerPrefs.DeleteKey("Resolution"); PlayerPrefs.DeleteKey("Shadows"); and so on....

I am getting alot of variables to save now and going to be a huge job so i found this :

PlayerPrefs.DeleteAll and EditorPrefs.DeleteAll

but what is the difference is it save to use? I don't want to lose everything i made....

does editorpreference's delete just my preference's in unity -> edit -> preference's or something else?

and does PlayerPrefs.DeleteAll delete's just my PlayerPrefs or has it side effect? I hope i can use this because it saves me alot of time... I think its obvious that is save to use but i want to be sure because in other programs i thought i knew it but when I did it my project was corrupted....

I hope i can ask this kind of stuff and don't violate any rules.

Thanks in advance,

Lemon,

EDIT : and if DeleteAll is just deleting. does it affect only for the project or game you are using/playing at that moment or for all games and projects you have?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
36
Best Answer

Answer by Antony-Blackett · May 15, 2011 at 01:23 AM

PlayerPrefs.DeleteAll() is definitely safe. In fact I use it daily to test if a new player to the game can unlock everything starting from scratch.

I'm unsure what EditorPrefs.DeleteAll() does though.. The docs don't seem to explain very much http://unity3d.com/support/documentation/ScriptReference/EditorPrefs.DeleteAll.html My assumption is that EditorPrefs is meant to be used specifically for tools and editing. Meaning that nothing in your game code should rely on EditorPrefs settings. The player in a final build will not have access to this class because it is contained within UnityEditor which is not compiled into a build.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ruben_hiet · May 15, 2011 at 09:58 AM 0
Share

ok thanks for your clear answer :) going to use it now then ins$$anonymous$$d of delete$$anonymous$$ey just wanted to be sure :)

avatar image CrandellWS · Mar 31, 2019 at 08:41 PM 0
Share

you are right the editor code does not get put in the binary output.

avatar image
79

Answer by fright01 · Apr 25, 2019 at 08:46 AM

There is now Edit > Clear All PlayerPrefs to perform this from the editor.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ltteixeira · Jul 02, 2019 at 12:45 PM 1
Share

This should be higher! Thanks :)

avatar image cmyd · Apr 04, 2020 at 02:32 PM 0
Share

This should be the best answer.

avatar image gurbrindersingh · Oct 02, 2020 at 03:09 PM 0
Share

oh! i didn't noticed when it was added. Thanks for the tip @fright01

avatar image
7

Answer by CrandellWS · Mar 31, 2019 at 08:40 PM

file down load

Quick Delete PlayerPrefs with Menu Button – Unity

code explanation:

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


use the menu: alt text


stack1.png (34.3 kB)
delplayerprefs.zip (355 B)
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Nixtheworld · Aug 11, 2019 at 10:47 PM 1
Share

This is awesome!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

PlayerPrefs.DeleteAll not working 1 Answer

Dynamically building a PlayerPrefs key 4 Answers

DeleteAll not working on android? 0 Answers

DeleteAll not working on android? 0 Answers

Where on iPhone editor are playerprefs stored. 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges