Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Save game questions

Hello, I am using Unity 2018.1.4f1 & AC1.67.2. When I am implementing the save game function, I encountered a few issues:

  1. When the animation controller in a animator component is changed during the game, the Remember Animator component seems not saving the animator controller. Is it the way it suppose to be or am I doing it wrong? The animator controllers are already under a Resources folder.

  2. In one case I am using Remember Transform with Save change in parent on a NPC. When the NPC hits the Player it will become a child of the Player for a few seconds.
    The issues is, if I save game when the NPC is NOT the Player's child, and then load the save during the NPC being the Player's child, the NPC will have no parent (correct) but treated the local position under the Player before load game as its global position after load game.

  3. How to handle changes in a scene when switching away from the scene? For example, if a conversation options are disabled or enabled, then the Player goes to another scene and come back later, how to keep the conversation option changes? Does it mean a save action is needed at every switch scene?

Thank you.


  • Sorry I forgot the 4th one in the last post:

    1. How to save the background music played by the action Sound -> Play Music?
    1. The Remember Animator does not save which Controller is being used - only the state of the animations within. Can you elaborate on the circumstances?
    2. Does the NPC have a Remember NPC component as well? I shall attempt a recreation.
    3. Scripting is required to transfer the state of a Conversation from one scene to another - see this wiki script.
    4. Music should be saved automatically.
    1. The Player (or NPCs) will have its standard animations (walk, run, idle etc.) changed in some events, and I currently handle this by switching the Animator Controller in the Animator component . I hope such change can be saved.

    2. It happens both with and without the ** Remember NPC** component.

    3. Thanks I got the conversation part. But how about other objects like Hotspot and Triggers on & off status? And also the objects being added or removed in the scene?
      What would the best practice to deal with these situations of retaining changes of objects across scenes?

    4. Thanks, I just somehow missed this.

    1. I'll make it optional in the next release.
    2. I cannot recreate. As parenting NPCs to the Player is not standard AC workflow, you'll have to provide clear steps for me to follow so that I can experience the issue for myself. Please do so in a new thread
    3. Keeping general track of things across scenes is typically done using Global Variables. A scene cannot access another that is not loaded - but such is true of any Unity game.
    1. Thanks.

    2. In this case I think it is a custom script attached to the NPC rather than a general issue. I will solve it inside the script.

    3. Understood.

  • Regarding issue 1:

    Thank you so much for adding the feature to save the Animator Controller in the Remember Animator component. In the manual it says the feature is an option. While I can see the new "Set default" check box, I cannot find the option to save the Animator Controller. Could you please advise how to use te new feature?

    I am using AC1.68.3 and Unity 2018.1.4f1. Thanks

  • The saving of the "runtime animator controller" is automatic, there is no option for it. However, as with any other change in asset file you wish to save, it's name must be unique, and placed in a Resources folder - see the Manual's "Saving asset references" chapter for more.

  • Hi, I am facing the issue that the Remembe Animator works during scene change, but not load game. When changing the player's sprite child animator, it doesn't work when load game. I am sure it is inside a "Resources" folder directly under "Asset". The player is set to be initialized upon scene starts.

    When I try to do a build, this error shows up:

    I am using Unity 2018.1.4f1 and AC1.69.4

  • Just tried even putting the player into the scene to begin with doesn't help.

  • I tested that it works on objects animators, it works on NPCs, it just doesn't work on the player......

  • I think I observed wrong, actually it can remember the animator state, but not the animator controller.

  • I am trying this alternative by putting the animator controller path inside a component variable. but it seems cannot get the path in the variable or correctly read the string?

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEditor;
    using AC;

    public class CustomRememberAnimatorPath : MonoBehaviour {

    private Animator anim;
    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator> ();
    void OnEnable () {
        AC.EventManager.OnFinishSaving += SaveAnimatorPath;
        AC.EventManager.OnFinishLoading += LoadAnimatorFromPath;
    void OnDisable () {
        AC.EventManager.OnFinishSaving -= SaveAnimatorPath;
        AC.EventManager.OnFinishLoading -= LoadAnimatorFromPath;
    private void SaveAnimatorPath (AC.SaveFile saveFile) {
        if (anim && GetComponent<Variables>()) {
            GetComponent<Variables> ().GetVariable (0).SetStringValue (AssetDatabase.GetAssetPath (anim.runtimeAnimatorController).Replace ("Resources/", "-").Split(char.Parse("-"))[1]);
    private void LoadAnimatorFromPath() {
        anim.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>(GetComponent<Variables> ().GetVariable (0).GetValue().ToString());   
  • The value is always empty after loading. I have the Remember Variable component attached.

  • The OnFinishSaving event will be called once the save file has been written to. Use OnBeforeSaving instead to have the change made to Variables be incorporated into the save.

    Going back to the original issue, the build error looks related to your system/OS settings. See these related threads on the Unity forums:

  • When I look into the AC RememberAnimator.cs, I see this line:
    [SerializeField] private bool saveController = false;

    and these under the SaveData() function:

    if (saveController && _animator.runtimeAnimatorController != null)
    animatorData.controllerID = AssetLoader.GetAssetInstanceID (_animator.runtimeAnimatorController);

    Do these scripts cause the animator controller not being saved? Should I turn saveController = true?

    I am using 1.69.4

  • If saveController is true, then the Animator's Animator Controller will be saved - provided that it has a unique name and is placed in a Resources folder.

    That it is not exposed in the Inspector is a bug. I will address this for v1.70, but in the meantime you can insert the following into the bottom of the same script's ShowGUI function:

    saveController = EditorGUILayout.Toggle ("Save controller?", saveController);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.