Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Saved variables lost for android release after migration from 2019.4 to 2021.3

Discussion in 'Visual Scripting' started by Kalrek, May 10, 2022.

  1. Kalrek

    Kalrek

    Joined:
    Aug 13, 2015
    Posts:
    7
    I wanted to upgrade my game to the latest unity version. This worked without problems, there were no errors and you could play the android game immediately in the editor after migration from bolt to visual scripting.
    But when I distribute an update to the google play store, based on 2021 version for android phones, it seems that the installed 2019 version on smartphones lose the saved variables values and everything is reset to the initial saved variables. Is there anything I need to be aware of or is it simply not possible to switch from bolt to visual scripting within a published game on Android if you are using saved variables?
     
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,775
    Saved variables serialize to PlayerPrefs which is not meant for saving game state. As the name implies, it's meant for saving player's preferences, things like screen resolution, windowed mode state, etc. The original Bolt creator did it that way because PlayerPrefs are supported on all platforms, including WebGL which does not have disk access and can't locally save data in any other way.

    UVS has inherited that arguably bad design.

    I'm not sure when PlayerPrefs stop referencing or clear previously saved values but it can happen in many ways - by changing Unity version, by updating the target platform's (ie Android) version, even switching build targets in build settings (for example, 32 vs 64bit) can lose previously saved values in PlayerPrefs. PlayerPrefs are not reliable for saving game state.
     
  3. Kalrek

    Kalrek

    Joined:
    Aug 13, 2015
    Posts:
    7
    That may be that it is unfavorable. Nevertheless, a lot of time was apparently put on a high compatibility and migration ability from bolt to UVS. So I'm just surprised that everything works except the saved variables. And actually, they do work. Only on an update on android, the old saved variables no longer seem to be recognized. Maybe there is someone who had the problem and solved?

    Beside that, I will take your advice seriously and look for alternatives for the UVS saved variables for future projects.
     
  4. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,775
  5. Kalrek

    Kalrek

    Joined:
    Aug 13, 2015
    Posts:
    7
    I bought the asset 5 years ago. Until last year it was unfortunately not compatible if you only used bolt for programming. I tried it again this week and now it works for me with 2019.4.38 and the latest version of Easy Save. I will implement this in the next update in my game and then switch in a few months to 2021 with UVS, that should actually work then.
     
  6. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,775
  7. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    71
  8. Kalrek

    Kalrek

    Joined:
    Aug 13, 2015
    Posts:
    7
    I just tried it out. The saved variables are now recognized! Then I can now upgrade the project from 2019 to 2021, using the newest assets and tools and at the same time implement a second saving system. Excellent.
     
    JuanGuzmanH likes this.