Forum rules - please read before posting.

[Major Bug] Variables lose runtime translations (workaround inside)

Recently updated to 1.70.2 And it seems that translated variables lose their runtime translations. The culprit seems to be the fact that there is options variables load which makes a copy of all instantiated variables, but after that there is not runtime translation update call. So if the variable is used exclusivley through AC.GlobalVariables, it doesn't have it's translation present

Current workaround is instead of getting the variable value with AC.GlobalVariables.GetStringValue or similar.

Do:
AC.GVar var = AC.GlobalVariables.GetVariable(..)
var.CreateRuntimeTranslations()
string thingYouNeed = var.GetValue(..)

Comments

  • edited February 2020

    I cannot recreate such an issue. Are you passing the current language in the GetStringValue's function parameters? Please share more details on how to recreate the issue.

  • Yes I'm passing the current language. This specific call gets me untranslated line:
    AC.GVar var = AC.GlobalVariables.GetVariable(MainManager.instance.useSyntaxVarID);
    string useSyntax = var.GetValue(AC.Options.GetLanguage());

    This gets me translated line:

    AC.GVar var = AC.GlobalVariables.GetVariable(MainManager.instance.useSyntaxVarID);
    var.CreateRuntimeTranslations();
    string useSyntax = var.GetValue(AC.Options.GetLanguage());

    I added Debug.Log() to GVar constructor. This is what I'm getting when initiating the game (gets constructed twice):

    Gvar constructor, id: 125
    UnityEngine.Debug:Log(Object)
    AC.GVar:.ctor(GVar) (at Assets/AdventureCreator/Scripts/Variables/GVar.cs:140)
    AC.RuntimeVariables:TransferFromManager() (at Assets/AdventureCreator/Scripts/Variables/RuntimeVariables.cs:315)
    AC.RuntimeVariables:OnStart() (at Assets/AdventureCreator/Scripts/Variables/RuntimeVariables.cs:46)
    AC.StateHandler:InitPersistentEngine() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:993)
    AC.StateHandler:OnAwake() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:84)
    AC.KickStarter:SetPersistentEngine() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:155)
    AC.KickStarter:OnAwake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:1126)
    AC.MultiSceneChecker:Awake() (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:50)

    Gvar constructor, id: 125
    UnityEngine.Debug:Log(Object)
    AC.GVar:.ctor(GVar) (at Assets/AdventureCreator/Scripts/Variables/GVar.cs:140)
    AC.SaveSystem:UnloadVariablesData(String, List`1, Boolean) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:1954)
    AC.SaveSystem:AssignVariables(String, Boolean) (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:1825)
    AC.RuntimeVariables:AssignOptionsLinkedVariabes() (at Assets/AdventureCreator/Scripts/Variables/RuntimeVariables.cs:182)
    AC.RuntimeVariables:OnStart() (at Assets/AdventureCreator/Scripts/Variables/RuntimeVariables.cs:47)
    AC.StateHandler:InitPersistentEngine() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:993)
    AC.StateHandler:OnAwake() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:84)
    AC.KickStarter:SetPersistentEngine() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:155)
    AC.KickStarter:OnAwake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:1126)
    AC.MultiSceneChecker:Awake() (at Assets/AdventureCreator/Scripts/Game engine/MultiSceneChecker.cs:50)

    Note, that I don't at any point alter the variable values, through actionlist or otherwise. Right now I just read the values using that code snippet.

    StateHandler.cs line number are the only ones that don't match with the original unmodified AC. But the only modification I have in StateHandler is moving onchangegamestate event. All other files in both callstacks are unmodified. If it's any help to you I have a single save file profile present. Not sure if that counts.

  • Thanks, I'll go through this and let you know if I need any more details.

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.