Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

PlayerPrefs and SharedPreferences in Android

$
0
0
There is a documentation error in the PlayerPrefs reference: http://docs.unity3d.com/ScriptReference/PlayerPrefs.html It says that playerprefs are stored in Android as [pkg-name].xml This was true until a recent Unity version. When I upgraded to 5.3 I noticed that my game stopped reading a deeplink url I was writing from my launcher Android activity to SharedPreferences: [packagename].xml. Now, it seems, I have to write it to [packagename].v2.playerprefs.xml for Unity to read it from PlayerPrefs. So here's how to access PlayerPrefs in android in Unity 5.3:
SharedPreferences playerPrefs = this.getSharedPreferences(this.getPackageName() + ".v2.playerprefs", Context.MODE_PRIVATE);
I don't know if it's ok to write question that includes the answer, but I thought other devs might run into the same problem.

Viewing all articles
Browse latest Browse all 1333

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>