Edit PlayerPrefs in Unity App

PlayerPrefs is a common way to save some variables in Unity applications. If we can view or even modify it, we can understand better how the app works, or maybe even hack it.

Android

On android, it’s simple to find and edit PlayerPrefs from shell. But unfortunately, it’s obligatory to have a rooted device. I strongly recommend using an emulator, however every rooted device will be fine.

ADB Shell

If you are familiar with ADB, you can simply use the command 

adb shell

Termux

If you don’t want to use ADB, you can use an app called “Termux” to emulate shell on Android.

Having access to android shell and going further requites us to escalate our privileges, because place what we’re looking for requires root access.

su

grants us root access. Now using command

vi /data/data/[package name]/shared_prefs/[package name].xml

we can edit PlayerPrefs. Vi has some advanced shortcuts, so googling how it works will help. PlayerPrefs are stored in XML files.

In entry, there is defined type, name and value of data. Strings in this file are encoded as URL. If you want to edit or read something that contains spaces, use some online converter — there is plenty of them on the web.

Leave a Reply

Your email address will not be published.