How to Edit Unity PlayerPrefs on Android
PlayerPrefs is how most Unity games keep their small values: coins, the level you’re on, whether the sound is off. On Android they end up in a plain shared preferences file, so on a rooted phone you open and change them like any other preferences.
Where the file is
Unity documents the path:
/data/data/[package name]/shared_prefs/[package name].v2.playerprefs.xml
Sand Balls, for example, is com.water.balls, so its file is com.water.balls.v2.playerprefs.xml. In CheatDroid, tap the game in the app list and the file is under Shared preferences. If the game has other preferences files next to it, they usually belong to ad and analytics libraries, not to the game.
Bigger saves, a whole world or an inventory, rarely fit in PlayerPrefs. Unity games write those as files into Android/data/[package name]/files, which CheatDroid lists under Files. Where Android games keep their save data has the rest.
What’s in it
- Three types, nothing else. PlayerPrefs only knows whole numbers, decimals and text, so the file holds
int,floatandstringvalues. CheatDroid shows each one’s type above its name. - Yes and no are numbers. There’s no true or false in PlayerPrefs, so a game stores an unlocked level or a bought item as
1, and locked as0. - Ints stop at 2,147,483,647. Don’t set coins to exactly that: the next coin the game adds can wrap it around to a large negative number. 999999999 is plenty.
- Some games keep a whole save in one string, usually JSON. Change the digits and leave every quote and bracket alone, or the game can’t read it anymore. If the text starts with
%7B, it’s JSON that was URL-encoded before saving:%7Bis{,%22a quotation mark. - Names and values that look like random letters are encrypted, often with an anti-cheat plugin such as Code Stage’s Anti-Cheat Toolkit. Those can’t be edited by hand. Try the memory scanner, or take it as a sign that this game doesn’t want to be edited.
Changing a value
- Open CheatDroid, allow root, tap the game, and open its
.v2.playerprefs.xml. - If CheatDroid says the game is running, tap Force stop. Unity keeps PlayerPrefs in memory while the game runs and writes them out when it quits, right over your edit.
- Search the file for the number the game shows. The search matches values as well as names.
- Tap the value, type the new one, and save.
- Start the game again.
Two walkthroughs do exactly this: Sand Balls (gems) and Perfect Slices (coins).
If you make Unity games
Unity says it plainly: PlayerPrefs is stored without encryption and isn’t meant for anything sensitive. Rooting a phone takes an evening, and after that, editing this file takes a minute. Anything a player could buy, check on your server. Encrypting the values only slows people down.