Facebook Twitter Gplus LinkedIn RSS

Unity Serializer

New Unity Serializer Version 2

With features like full JSON serialization, the ability to store any object you make up at run time and quick access functions for saving and reloading individual items – Unity Serializer v2.0 is a major step forward in serialization technology. Get it now…

See the new features here…

Serialization in Unity

If, like me, you believe that Unity should contain a built-in save game function then you may be interested to know that based on many of your comments, I have offered Unity the opportunity to adopt “Unity Serializer” and to help them integrate it with the core system.

I hope you will think this is a good idea – if you do you can follow this link to the feedback section of the community (or click on the voting button below) and use it to vote for the addition of Save Game features to Unity (not necessarily mine!), perhaps leaving a comment in support of Unity Serializer.

UPDATE: Since posting this note we have already doubled the score for save game support!

Thanks for your support!



Please report bugs on my support forum here and feature requests can be made on this board.

Preferred Download

The best download to use is the version available on the Asset Store - if you download this you will automatically be able to get updates through the Asset Store.

 You do not need Unity 3.5 to run Unity Serializer – this is an Asset Store rule concerning the version of Unity I use to upload the project.

All Downloads

Unity Serializer is free for you to use, but if you would like to support the project (and help me cover my hosting fees!) then you can do so with the PayPal link above.


UnitySerializer is a full level serialisation plug in.  It enables you to save the progress of a game and restore it at some point in the future.  It does this with minimal impact on the design of your game and requires minimal modification to your behaviours and classes.  The package also contains a “room” manager that helps you save the states of scenes that the player has left and subsequently re-enters.


Works on all Unity runtime platforms including IOS and Droid.  If you are running on an AOT platform (like iPhone or Android) you should check out this post to do with player settings that may be important based on your coding style.


The serializer supports storing newly instantiated prefabs, as well as the status of existing scene objects (such as those that might be destroyed during the course of a game).

UnitySerializer supports the serialization of your custom classes, fields and properties including things like generic collections of complex objects as well as standard Unity components including

  • Animation support
  • Rigidbody support
  • Lights, Joints, CharacterController
  • Materials & Textures (references and programmatically generated)
  • Support for NavMeshAgent
  • Transform – including parent/child relationships
  • JSON or compressed binary formats
In addition, presuming you use my extended coroutine start functions, all of your coroutines will continue executing from the point that they left off and will be restored with all local variables intact. You need make no changes to your coroutines – just to the way that you start them.

The status of your level is stored in a string which can be placed in PlayerPrefs – stored on a server or in a file.

For those interested in the details of extending the serialization methods, some advanced features or for those who would consider contributing to the project there is a technical discussion of the serialisation implementation available here.

YOU ARE LICENSED TO USE THIS CODE FOR ANY PURPOSE – THERE ARE NO WARRANTIES EXPRESSED OR IMPLIED. MIT LICENSE. USE AS YOU SEE FIT.  If you use this in a commercial project or are a professional studio I would appreciate a donation – it is not required – but bug reports from supporters will be prioritised.  If you use this code as part of another framework that you distribute please add a link to this page and a credit to me as the author of that section.

Please email me if you wish to contribute time to this project.

Save game for Angry Bots in less than 2 minutes!

In this video I just save everything, when you save your own level – pick and choose the things you want to save to keep performance higher and saved games smaller.

Getting Started

Please see the Getting Started Guide for Unity Serializer available on line and as a PDF download. There is also an FAQ that you can peruse.

Version 2.0 features

If you want to learn about the new features in version 2.0 including JSON support you should read this page.

Unity Serializer Menu & Wizard

There is a Wizard that can help you configure your game and a new Unity Serializer menu bar will appear after you have imported the package.  You can use the wizard to help you setup your scenesThe Wizard also contains maintenance commands to delete saved games.

There are also short cut keys to add a new script to the current object.  I strongly suggest you use the wizard for most scene configuration.

You will also be able to see colour coded information in the hierarchy view showing what script is attached to each of your game objects.

Unity Serializer References Wizard

The new page of the Unity Serializer wizard helps you to identify areas that might make saving and loading your game less robust.  Unity Serializer stores Asset references by using their type, their name and an index (so if there are three things called Take 001 – each one has an index starting from 0).  It makes your save games more robust if you keep each of the items you will refer to uniquely named.  It is not a requirement that they are unique it just improves the robustness of your saved games if they are.  The page on the wizard highlights items with matching names and lets you click on them to view them in the project window.  Items shown in red are internal to Unity and are hence quite possibly going to change more often.

NOTE: You will probably see a lot of things in this window that you never use in a reference.  You can just ignore those.

JavaScript & C# Support

You can use Unity Serializer from Javascript – so long as your javascript is not located in the Standard Assets or Plugins folders.

There is an example pause menu in the Asset Store and main package downloads here – called PauseMenu.js that will show you how to call the functions in the context of a simple javascript pause menu – activated in the demo with the P key.


iTween support is downloadable as an add on module. It enables the storage and restart of any tweens running on objects that have at least StoreInformation attached to them

In order for this to work it is necessary to add 2 lines of code to iTween. Find the IEnumerator Start() function in iTween.cs and insert the code:

   yield break;

You will need to do this each time up upgrade iTween.

Why Is Unity Serializer Free?

You might be wondering what’s wrong with it, it’s free!  Why would someone give away something extremely powerful for nothing?

I believe some things should be free because everyone needs them – and if a lot of people use Unity Serializer I will benefit too from all of the testing and ideas for improvement.  I had to write this code for my game – I believe that any small amount of money I would make from selling this just isn’t worth it and would deny a whole bunch of  people the ability to build a complete game quickly. 

People should be getting on and thinking about their game play, not worrying about how to save their levels!

I do think that if I save you a bunch of time by using Unity Serializer and make some money from your game – it would be nice of you to make a donation for the upkeep of the project. 

In short:

  • It works
  • It’s supported
  • It’s free



I’m a big fan of PlayMaker and given that many PlayMaker users that aren’t programmers may have a problem adding Load/Save functionality I’ve developed a plug in that you can download to enable PlayMaker Finite State Machines to be saved. Once the plug in is installed you just have to attach a Store Information script to the objects that have the FSMs attached.

The plugin saves all of the local and global variables in addition to the current state of the FSM and restores all of these on load. Note that even if you only save 1 FSM, all of the global variables will of course be loaded – this might lead to strange behaviour so it is probably better to make sure you store all of your PlayMaker enabled objects.

NEW PlayMaker Actions & Demo Scene

The PlayMaker add on now has custom actions for PlayMaker to save games and checkpoints.  The package also includes an example scene that uses these actions to make a rudimentary save game menu.


I’m adding support for as many types as possible – but I may not cover every case.  Don’t worry – you can still serialize your levels, but you might have to do some work ;)

Say you create a mesh and change the mesh of a renderer to the runtime constructed one – as of writing (version 0.84) you can’t serialize these meshes directly (it’s coming I hope!)  However you could just store enough information to recreate the mesh in some variables on a script and then write an OnDeserialized() function which takes those values are recreates whatever you need.

I will strive to add as many types as possible – but OnDeserialized() is your friend because in there you can build anything you need that hasn’t been automatically saved.

Tolerant to change

UnitySerializer does it’s best to cope with you changing the public fields and properties of your class.  Internally it tokenises the names of things and uses these to set the values back later so it can copy with quite extreme changes to structure – e.g. adding and removing large numbers of properties or fields.  It’s not so good when you change the type of a field or property to one that is not compatible (castable) from the original stored value.  If you need to change things like this I suggest you create a new property or field rather than reuse an existing name.

You can also store your files using Verbose mode – that will provide extra serialization information and does attempt to fix changing types.

To turn on Verbose mode you need to import Serialization and use UnitySerializer.Verbose = true;

In this mode you can also handle an event MapMissingType that allows you to supply a replacement type if it is semantically similar to a now defunct former type. UnitySerializer.MapMissingType += YourMissingTypeHandler;

Home Forums Unity Serializer

This topic contains 1 reply, has 2 voices, and was last updated by  kehos 1 year, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #973


    PLEASE COMMENT ON THE ROADMAP FOR Unity Serializer – available here. Support Please report bugs on my support forum here and feature requests can be m
    [See the full post at: Unity Serializer]



    Hello, I’ve downloaded your UnitySerializer and this is amazing! But I have one doubt, where can I find the saved games? I’m looking for that in the documentation and I’n not able to find it.

    Thanks a lot and congratulations for your excellent work! :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Cool Stuff

Whydoidoit.com is all about cool stuff for Unity & Silverlight that's hard to find elsewhere. Everything on here is free to use - so dive in, grab what you want and feel free to ask questions.


You can get great support for all of the projects by using the forums. Feel free to make feature requests, report bugs or just ask for help to get going.

Enter your email address to subscribe to this blog and receive notifications of new posts, releases and products by email.

Home Unity Serializer