We are porting an Android game from Cocos2d to Unity. We want to move players' saved game setting with the new install. In the original (Java/ C++) version of the game, we saved these in SharedPreferences. Example (somewhat truncated):
public String getUserPref (String key) {
String val = getSharedPrefs ().getString(key, "");
return val;
}
private SharedPreferences getSharedPrefs () {
if(sharedPref == null) {
sharedPref = Cocos2dxActivity.getInstance().getSharedPreferences("GamePrefs", 0);
}
return sharedPref;
}
How can we now access the original SharedPreferences? We'd really like to avoid writing an Android Library for this. I understand that Unity PlayerPrefs stores/ access SharedPreferences, but under a different name. We need to access prefs stored under the GamePrefs name.
↧