Saving a ScriptableObject .asset on Android?

I have a strange issue and I feel like my step up is wrong somehow.

I’m using a ScriptableObject as an item shop, where a bool a checked if you purchased or owned one of the items. While I’m using the Unity Editor, when I run the game and purchase an item, the bool is saved on the .asset file and functions how I want it to.

However when I run the game on my Android device, the bool is checked until the application closes. When you restart the game, it resets to it’s original state. How would I make this work on my Android device the same way it does in the editor?

ScriptableObjects are objects that are not owned by game objects, and that can be serialized by Unity’s built in serialization system as an asset.

Once loaded into memory (by calling ScriptableObject.CreateInstance), the data you store into this class will only be available at runtime.

AFAIK, Unity’s serialization is only available inside the Editor, so you cannot take your ScriptableObject and store that to persistent storage while running on a device.

To achieve that, you can implement your own serialization system, or use the PlayerPrefs class.

Yep, found myself in the same trap :slight_smile: Eventually, as far as I’ve figured out, there are lot of the appropriate solutions so as to save&store data and it’s up to you which one to use. PlayerPrefs, JSON, Custom serialization etc. PlayerPrefs the easiest one, though. Thank you guys @liortal and @Bunny83 for the clarification!