Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[WP8] Saved data lost after installing new build? How do users install new update then?

Discussion in 'Windows' started by vexe, Jan 25, 2016.

  1. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Greetings,

    So I'm working on porting our game to Windows Phone 8, got the port working fine. I'm using FullSerializer (JSON) to serialize my data and a get a string that I store in PlayerPrefs. When I save and quit the game, and come back again, everything's loaded back just fine.

    But, every time I make a new build from Unity and run it, the saved data is gone. I'm just worried because how are users supposed to update to a new version of the game then? Why is the data lost if it's being saved to PlayerPrefs? Is PlayerPrefs local to each app on the phone and not global? i.e. when you uninstall something anything related to it is now gone?

    Any help or advice is appreciated.

    Thanks.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    PlayerPrefs is indeed local for each application. Uninstalling and reinstalling the application will purge it. Unity's "Build and Run" butto uninstalls and reinstalls the application, thus deleting all the data. I believe Visual Studio is able to deploy "incrementally", without deleting application data. When users download an updated application from the store, it will be reinstalled incrementally - no data will be lost.
     
  3. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Thanks for the reply. Haven't done this before. Just to make sure, I don't touch the generated Visual Studio project to deploy. I just build from Unity. Should I be messing with something in the generated sln to make things work or no? Just trying to make sure if I need to do anything special on my part to get this to work properly.

    Another thing, how do you set breakpoints and stuff and step into your code while the game is running on the phone? Is that what the Visual Studio sln is for? I tried launching it but it doesn't have my game source in it because I assume it's running it dynamically from a DLL? Also the game runs a lot slower when I run that sln.
     
  4. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Also, is there anyway I could turn on the incremental build feature when building from Unity? Otherwise how would I be able to do data integration tests and simulate users updating to a new version of my app?
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Our "Build and Run" tool doesn't unfortunately support incremental deployment. You might have more luck with the deployment tool that comes with the SDK (AppDeploy.exe/AppDeployCmd.exe).

    Visual Studio uses incremental deployment by default - you don't need to change anything for it to do it.
     
  6. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Thanks! Any tips for stepping into the code/breaking at breakpoints?

    And phone debugging in general. I noticed you get a developer console if you check 'Development build' but it seems it only shows errors? Anyway to get it to show regular Debug.Log messages? Or does it dump it to another file and you'd have to use a cmd tool to see the output (like adb logcat on Android)
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Oops, missed that question on breakpoints. Copy pasting my reply from another thread.

    Regular Debug.Log messages should show up in visual studio "output" window.
     
    vexe likes this.
  8. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Sorry I'm not sure I fully understand that.

    What project are we talking about? Cause there's two:
    - The UnityVS project in Unity, where the code is written.
    - The generated .sln after you build.

    If I open the generated .sln I could build and run the game, but I don't get any logs in the Visual Studio console. I don't see where my source code is so I can't place breakpoints. Where are you supposed to place the breakpoints then?

    Could you elaborate a bit more?
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    I'm talking about the solution file which gets generated when you build from Unity. It is the project that you build and run to deploy to the device.

    It indeed does not have your source code, however, you can still open your source code files in that visual studio instance, place breakpoints in there and it should "just work".
     
    vexe likes this.
  10. vexe

    vexe

    Joined:
    May 18, 2013
    Posts:
    644
    Thanks. That is, strange.. but it works.

    I'm getting errors only when I deploy from that generated sln.

    "NpRigidDynamic isSleeping Body must be in a scene"

    I don't get that if I run the game after "Build and Run"

    Any ideas?
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,646
    Looks like PhysX debug spew - any chance you're running in debug configuration? Switch to "Release" and it should go away. Build and Run uses "Release" configuration if you check "Development build" and "Master" configuration if you don't.
     
    vexe likes this.