Skip to main content

What is Persyst, and why should I care?

Persyst (portmanteau of Persistence System) is a plugin that allows you to easily implement persistence in your Unity applications. While Unity has a fully functional serialization system for changes made in the editor, there is no out-of-the-box support for serializing changes that you make during play mode or in builds.

If you are making a game, that means saving the player's progress can be tricky. For small projects you might be able to get away with manually coding how every bit of information gets serialized into a file with custom string keys, and then reading back the file and assigning the information to the runtime objects. For larger projects, this approach is a nightmare.

Persyst makes creating a real save system much more convenient. By using Reflection, the serialization logic is abstracted away so that you only need to think about what you want serialized, and not worry about how.

For example, if you wanted to save an integer value in a MonoBehaviour, this is all the code you would need to write:

using Persyst;

public class SerializableMB : MonoBehaviour, ISaveable
{
[SaveThis] int someValue;
}

Easy, isn't it?

The basic usage is designed to require no coding experience at all. If you want some more advanced features in your save system, there are many ways to easily build upon the fundamentals with a small amount of code. Section Extending Persyt includes some examples of how to implement commonly wanted features that require a little more involvement.

Formats, encryption?

Persyst stores the data in plain old JSON files. That's it. No compression, no encryption, no nothing. Just to be clear, if security is a concern, there is nothing stopping you from taking the json string that is generated by Persyst and encrypting it with another tool, or even your own crazy algorithm. It's just that no encryption methods are bundled in with Persyst itself, because that's just not what it's for.

Shoud I use this?

You might expect me to say "of course!", but there is actually a little more to it. Persyst is a small project that I developed for my own use, and only decided to make public as an afterthought. As such, you can expect some limitations in its features, and I cannot guarantee a complete absence of bugs.

Even though I believe this project is a very useful resource that many people can greatly benefit from, I must say that if you are working on a very serious or very large project, there are better alternatives. For example, EasySave.

Why ever use this one, then? Cause it's free, baby.

How to learn?

This website contains an extensive (maybe too extensive?) discussion of everything I believe you need to learn. But, of course, it might still be a bit confusing to be lectured about these things here, in a web browser. So, the Persyst repo has an "Examples" folder, with some unity scenes and some scripts that you can use to test things yourself by clicking buttons and changing code. It's fun! Kind of.

Each example folder has a readme file with more explanations, so you actually know what you are doing. I would recommend reading the "Getting Started" section here first, but everyone has their own learning process, so what do I know.