PlayerPrefs stops working in Editor if root key deleted via RegEdit (Android only?)

Found in Unity 2021.2.17f1

For the last year or so we’ve been using PlayerPrefs to store save data, and would routinely delete the entire folder via RegEdit to flatten the save and start over. This never caused a problem.

However, with the target platform set to Android (and/or having upgraded to 2021 from 2020), deleting the root key renders PlayerPrefs non-functional when running in the editor until Unity is restarted. Any attempt to write a value produces a generic ‘PlayerPrefs could not write value’ error.

I usually just sprinkle in PlayerPrefs.DeleteAll(); and execute it.

You can also trivially hang that code in a MenuItem in an editor script.

I even include the ability in a few of my random objects, if they are a kind of thing I need to debug and wipe a lot, such as in my Datasacks editor scripts.