Implement Own Expansion of Saved Data


This page describes how to add your own expanded data to Utage’s save/load functionality.
To customize the save/load operation, all you need to do is follow these two steps:
・Create a component using the IAdvCustomSaveDataIO interface, and write the save/load processing logic inside it.
・Register the object containing that component in AdvEngine>SaveManager>CustomSaveDataObjects.

You can save the data from your own game using Utage’s functionality, as well as your own expansions by using in conjunction the methods for calling programs, such as SendMessage or SendMessageByName.


This sample handles the ‘Advertisement Display Flag’ from Utage’s scenario data and and also reflects it in the saved data.

Create a Component Using the IAdvCustomSaveDataIO Interface

The components for saving/loading need to use the IAdvCustomSaveDataIO interface.
IAdvCustomSaveDataIO Interface

Below is a sample component that implements the IAdvCustomSaveDataIO interface.

using UnityEngine;
using Utage;
using System.Collections;

/// <summary>
/// ADV用SendMessageByNameコマンドから送られたメッセージを受け取る処理のサンプル
/// </summary>
public class SampleSendMessageByName : MonoBehaviour, IAdvCustomSaveDataIO
    public bool isAdOpen = false;
    void SetEnableAdvertise(AdvCommandSendMessageByName command)
        this.isAdOpen = command.ParseCellOptional<bool>(AdvColumnName.Arg3, false);

    public string SaveKey { get { return "SampleSendMessageByName"; } }

    public void OnClear()
        this.isAdOpen = false;

    const int Version = 0;

    public void OnWrite(System.IO.BinaryWriter writer)

    public void OnRead(System.IO.BinaryReader reader)
        int version = reader.ReadInt32();
        if (version == Version)
            this.isAdOpen = reader.ReadBoolean();
            Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));

Create an Object that Uses a Component

Create a new component and then add the newly created component.

Register Object in SaveManager

Register the newly created component in AdvEngine>SaveManager>CustomSaveDataObjects.

Operate Object from Scenario

Use the SendMessgaeByName Command, etc. to operate the object from a scenario.

Verify Save/Load

Verify that save/load operations have been executed correctly.

Save Timing

Utage’s save functionality saves each page’s beginning status automatically in the background every time a page is changed.
Please take care as the timing of this functionality is not based on the press of a Save button.
The reason for this is that after loading files, pages need to be reopened from the beginning.

Related Information