Forum rules - please read before posting.

Variable set in OnBeforeSavig event not saved

Variable set during the OnBeforeSavig event is not saved. Variable has a default value after loading the save.
The value of the variable is being set, I can see the runtine value in the Variables tab. Could this be a bug or am I missing something?

Unity: 2020.2.0f1
AC: 1.72.4 / 1.73.0


  • I can't reproduce such an issue - what is your code, and what type of variable are you writing to?

    Check the variable's value in the save file using the Save File Manager in the Settings Manager - is it set correctly there?

  • It's a local Vector 3 variable, I'm storing an object's local position in there. The value after loading is set to 0,0,0.
    I've check the Save File Manager and the data are stored correctly there.

    Here's the code:

    void BeforeSaving(int saveID) {
        if(LocalVariables.GetBooleanValue(9)) LocalVariables.SetVector3Value(15, carriage.localPosition);

    EventManager.OnBeforeSaving += BeforeSaving;

  • This may be a duplicate of a similar issue that was addressed in v1.73.0. In a backup/duplicate project, import the latest AC and see if it's still occuring.

  • Aye, it's happening with the latest AC version too. Anyway it seems then as issue with loading the value, not saving it. It's linked to Vector3 variable, if I do the same thing with a string value it works just fine. Loading Vector3 value seems to problematic even if it's not saved inside the event though.

    15:18,02,6,9,0 (from the save file) should be (18.02, 6.9, 0)
    The data are stored, but is it stored correctly? Could this be parsing problem?

  • Yes, looks like. Seems to be the same issue as this thread - have a look through the suggestions to see if they help.

  • It seems rather complicated. Anyway since this is not an AC's issue, I won't be discussing this issue here furthermore. I'll probably just choose to avoid using the Vector3 variable for now.

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.