https://www.youtube.com/watch?v=NSC6mHsJusQ


Unlike version 1.x the save data in this version is modular. To define data you’ll need to make your own class for it. You can make as many of these as you need to hold your data, splitting up elements of your save as needed.

For ease of use you can make your own either by hand or using a little tool in the asset, below I’ll go over both methods:

🔧 Using Tool


The tool can be accessed via the following path:

Tools > Carter Games > Save Manager > Save Object Creator

Untitled

This will open this little window, from here all you need to do is enter a name for the class you’d like to make. By default the class name will be what you enter followed the “SaveObject“, so if I entered Cake it would default the name to CakeSaveObject.cs

Untitled

When you press the create button it will ask you tochoose save location for the new class. Note this needs to be in the projects Assets/ folder. You can rename the file if you are not happy with the generated name. Once you press save the file will be generated.

Untitled

Once the script has been generated and the project has recompiled, you will be prompted with the option to make a new instance of the save object you just made, if you press cancel nothing will happen and you’re all set. If you press yes a new save object (scriptable object) will be generated at the same path the class was just created to so you are all ready to use the new object in your project.

The creator uses a template file provided with the asset which I’ll show below, it has a comment for where you should put your save values. You can also change the namespace and createassetmenu setup if you wish.

using CarterGames.Assets.SaveManager;
using UnityEngine;

namespace Save
{
    [CreateAssetMenu(fileName = "%SaveObjectName%")]
    public class %SaveObjectName% : SaveObject
    {
        // Enter your save values here...
    }
}