Search Unity

UWP Xbox Live Offline Connected Storage

Discussion in 'Windows' started by cocacough, Feb 28, 2019.

  1. cocacough

    cocacough

    Joined:
    Jul 1, 2015
    Posts:
    78
    Hi,

    I was wondering if there is a way to still save data using connected storage even if the user disconnects from Xbox Live. The expected behavior for XR-074 is that "the title must continue to save data when expected after resuming from a suspended disconnection to Xbox services."
    Any help would be appreciated.
     
  2. matt33315

    matt33315

    Joined:
    Mar 28, 2014
    Posts:
    94
    I save progress locally (using player prefs) in my game then if I have an active connection to Xbox live uploaded the same data to connected storage. This approach does mean I have to handle syncing of the data when loading from Xbox live. The data on the local device may be more up to date than what is in the cloud. I ended up comparing each value I was saving in turn to work out which one to take, but you could equally stick a time stamp property in your save file and just always take the latest.
     
  3. kennyb

    kennyb

    Joined:
    Feb 23, 2015
    Posts:
    14
    I'm currently trying to figure out how to detect such a loss of connection so I can show the message required. Anyone have any tips? Is there an error code you can get back when attempting to save / load, or some event I can handle?
     
  4. matt33315

    matt33315

    Joined:
    Mar 28, 2014
    Posts:
    94
    Try checking to see if the Xbox Live context is not null before making the call to save. I think if the user gets disconnected the context will be null. You can then show a message to the user / handle the save locally instead of calling the Xbox Live save