PlayerPrefs: force *Load*?

Can I force Unity to reload PlayerPrefs from disk?

It is possible to force PlayerPrefs to be saved using PlayerPrefs.Save(), however, there is no equivalent for loading.

I have a WebPlayer game, and at certain times I want to synchronize between multiple instances in different windows - eg. if the player saves his game in one WebPlayer instance, I call PlayerPrefs.Save() to ensure it’s on disk, but when in another WebPlayer instance he needs to Load, I need to ensure that PlayerPrefs are reloaded.

From testing, the WebPlayer ignores changes to the underlying file.

Well, i don’t think that’s possible. Interprocess communication was never the aim of PlayerPrefs. Sure, it would be nice to use it that way, but i guess you have to communicate over your hosting server. I don’t see much alternatives.

Well, when hosted on the same domain (which would also be necessary for PlayerPrefs since it depends on the URL) you could try to go through the browsers Javascript with ExternalEval, find the other instance and use SendMessage of the UnityPlayer-plugin.

It might get a bit tricky to locate the other instance(s), but when you created the webpage you can always name the window / tab in a way it can be found by others.

I’ve had it update while the game is playing before, with no problem. Are you using PlayerPrefs.Load()? It might be what you are looking for. If not, then… I’m not sure how to help you!