Forum rules - please read before posting.

Save Global Varaibles [Probably BUG]

When I work on Save - Load and Optimisation stuff.
I discovered a problem. For example;
I have a Global Var in Type of Vector 3 named Hat Position. The
Default value is (0,0,0).

After set the Hat Position through an ActionList to (0,200,0) and saved game after action list is ended. The Hat position is save as (0,0,0). I examine this data through Settings -> Manage Save-Game Files.

I thought tha might be a problem with my managers. I switch them to default managers and then try to recreate
this problems again and the Hat Position is saved as (0,0,0) again .

And then I recreate a new Project and add AC to project. Then I create a new Game through game wizard. But the problem still the same. The Hat Position still saved as (0,0,0).

Comments

  • edited January 2022

    I cannot recreate such an issue in the latest release. What is your AC version, and what platform are you building to?

    Are you relying on any custom save method? Let's see screenshots of the Action and variable involved.

    If you have Show realtime values? checked in the Variables Manager, and view the Variable's entry when you save, what value does it show?

    The saving of variable data occurs in the SaveSystem script's CreateVariablesData function. Look for the "case VariableType.Vector3" statement: if you place a Debug.Log in there, it may help reveal the issue.

  • edited January 2022

    What is your AC version, and what platform are you building to?

    AC: 1.73.0
    Unity: 2020.1.2f1
    Build: PC

    Are you relying on any custom save method? Let's see screenshots of the Action >and variable involved.

    I'am not use any custom save methodes. Just use Variables -> Set : Global Variables

  • Using a backup/duplicate project, does this occur for you in the latest release?

    Inside SaveSystem.cs, look for the following line inside its CreateVariablesData function:

    variablesString.Append (vector3Val);
    

    Underneath, paste the following:

    Debug.Log ("Vector variables " + _var.label + ", Value: " + _var.Vector3Value + ", Saved: " + vector3Val);
    

    That should report the variable when saved in the Console - does it show, and what does it say?

  • Vector variables Vector3 Test, Value: (54.0, 12.0, 0.0), Saved: 54,12,0

    But in Save-game Manager still show (0,0,0)

  • What was the result of testing the latest release, and what platform is active in your Build Settings?

    Place another Log just above the last line of the same function:

    Debug.Log (variablesString.ToString ());
    

    What does that show, stacktrace included?

  • What was the result of testing the latest release, and what platform is active in >your Build Settings?

    vector is (0,0,0) after save.

    What does that show, stacktrace included?

    Vector variables Test Vector3, Value: (54.0, 12.0, 0.0), Saved: 54,12,0
    UnityEngine.Debug:Log(Object)
    AC.SaveSystem:CreateVariablesData(List`1, Boolean, VariableLocation) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:1580)
    AC.RuntimeVariables:SaveMainData(MainData) (at Assets/AdventureCreator/Scripts/Variables/RuntimeVariables.cs:211)
    AC.SaveOperation:SendSaveToFile() (at Assets/AdventureCreator/Scripts/Save system/SaveOperation.cs:141)
    AC.SaveOperation:BeginOperation(SaveData&, SaveFile) (at Assets/AdventureCreator/Scripts/Save system/SaveOperation.cs:81)
    AC.<PrepareSaveCoroutine>d__50:MoveNext() (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:858)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    AC.SaveSystem:SaveSaveGame(Int32, Boolean, String) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:801)
    AC.SaveSystem:SaveGame(Int32, Int32, Boolean, Boolean, String) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:783)
    AC.SaveFileManager:SaveFileGUI() (at Assets/AdventureCreator/Scripts/Managers/SaveFileManager.cs:315)
    AC.SaveFileManager:OnGUI() (at Assets/AdventureCreator/Scripts/Managers/SaveFileManager.cs:52)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    
    0:54,12,0
    UnityEngine.Debug:Log(Object)
    AC.SaveSystem:CreateVariablesData(List`1, Boolean, VariableLocation) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:1581)
    AC.RuntimeVariables:SaveMainData(MainData) (at Assets/AdventureCreator/Scripts/Variables/RuntimeVariables.cs:211)
    AC.SaveOperation:SendSaveToFile() (at Assets/AdventureCreator/Scripts/Save system/SaveOperation.cs:141)
    AC.SaveOperation:BeginOperation(SaveData&, SaveFile) (at Assets/AdventureCreator/Scripts/Save system/SaveOperation.cs:81)
    AC.<PrepareSaveCoroutine>d__50:MoveNext() (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:858)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    AC.SaveSystem:SaveSaveGame(Int32, Boolean, String) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:801)
    AC.SaveSystem:SaveGame(Int32, Int32, Boolean, Boolean, String) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:783)
    AC.SaveFileManager:SaveFileGUI() (at Assets/AdventureCreator/Scripts/Managers/SaveFileManager.cs:315)
    AC.SaveFileManager:OnGUI() (at Assets/AdventureCreator/Scripts/Managers/SaveFileManager.cs:52)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    
    
  • Prepare a test scene that contains a Variable: Set Action that sets the variable, and check that saving the game in that scene afterwards causes the issue.

    Then, create a .unitypackage file of the scene, and your game's Managers. PM it to me, and I'll take a look.

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.