0
\$\begingroup\$
Context

I was working on an editor window that had to toggle Preferences > General > AutoRefresh via script so I was using Unity's EditorPrefs API.

Problem

Editor prefs are saved not in yaml files (or some interchange format) but instead by using OS specific features: using the registry in windows, and .plist files on macOS.

For some reason on mac in Unity 2018.3 the key for the "AutoRefresh" is "kAutoRrefresh" in the plist file while in the windows registry for Unity 2021 it's "kAutoRefresh_h2404942332". However it seems I can still access the the windows key in editor via EditorPrefs.HasKey("kAutoRefresh") == true despite that not being its actual name. Does anybody know the reason for this?

I'm guessing anything after the '_' acts as metadata, why would the mac plist not require the same metadata?

I can't find any documentation on this so mainly I'm worried these keys are going to silently change out from under me on a different Editor Version or OS.

Why not save prefs in a normal file

Are there any benefits to opting out of using portable formats and the file system? It seems like a pretty poor design choice for portability. Windows Registry is actually a binary format, so perhaps it's a way of saving a tiny bit of space while still allowing your data to be human readable as the OS has its own native application to make it presentable?...

\$\endgroup\$

You must log in to answer this question.

Browse other questions tagged .