none
Creators Program Unity Xbox Live Storage example failing?

    Question

  • I'm trying to hook up storage in my Creators Program game, and I'm trying out the GameSaveExample Unity scene that is from the GameSave.unitypackage (which is itself inside the XboxLive.unitypackage, which I downloaded from https://github.com/Microsoft/xbox-live-unity-plugin/releases).

    When I build the Unity example into a UWP application and then compile and run the UWP from my local computer (making sure the generated UWP application and my computer are both using the set up sandbox), the app throws an exception right after successfully signing in my Xbox Live account:

    System.ArgumentException occurred
      HResult=0x80070057
      Message=Value does not fall within the expected range.
      Source=<Cannot evaluate the exception source>
      StackTrace:
    <Cannot evaluate the exception stack trace>

    'XboxLiveStorageTest.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Users\Michael\Documents\Unity\XboxLiveStorageTest\Build\XboxLiveStorageTest\bin\x64\Debug\AppX\System.Diagnostics.StackTrace.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

    Exception thrown: 'System.ArgumentException' in Assembly-CSharp.dll

    GameSaveHelper.Initialize Error: System.ArgumentException: Value does not fall within the expected range.

       at Windows.Gaming.XboxLive.Storage.GameSaveProvider.GetForUserAsync(User user, String serviceConfigId)

       at Microsoft.Xbox.Services.ConnectedStorage.GameSaveHelper.<Initialize>d__2.MoveNext()


    It looks like the following line in GameSaveHelper's Initialize method is failing because xboxLiveUser.WindowsSystemUser is null:

    var initTask = GameSaveProvider.GetForUserAsync(xboxLiveUser.WindowsSystemUser, configId).AsTask();

    The same thing seems to be occurring when I compile the UWP and run it on the console.  The app just stops at showing "Initializing save system...".

    Should this example be working?

    Console OS Version 10.16299.5090

    Windows OS Version 1709 (16299.125)

    Unity Version: 5.6.4f1

    VS Version: 15.4.1

    Thursday, January 25, 2018 6:47 AM

All replies

  • Hi Mike,

    Usually I've seen this happen if you're missing: "Xbox Live Platform Extensions SDK" from: http://aka.ms/xblextsdk

    Do you know if this has been installed?

    Thursday, January 25, 2018 6:24 PM
  • I installed the SDK before I tried working with the storage functionality.

    I used the link (http://aka.ms/xblextsdk, which looks like the same as yours) from this page:

    https://docs.microsoft.com/en-us/windows/uwp/xbox-live/get-started-with-creators/configure-xbox-live-in-unity

    The downloaded file gave me three versions (10240, 14393, and 15063), and I installed 15063 because it was the closest to my OS version (16299).

    I can try installing a different version if you think it might help-

    Thanks!

    Thursday, January 25, 2018 6:45 PM
  • Hi Mike,

    Our team is investigating this issue and we will let you know what we find once we have more information.

    Kam Woo - Xbox Live Forum Moderator

    Friday, January 26, 2018 4:53 PM
    Moderator
  • As a (temporary) workaround, I was able to use some code from another game save example (https://github.com/Microsoft/xbox-live-samples/tree/master/Samples/ID%40XboxSDK/GameSave):

                // Getting a GameSaveProvider requires the Windows user object. It will automatically get the correct provider for the current Xbox Live user.
                var users = await Windows.System.User.FindAllAsync();
                if (users.Count > 0)
                {
                    var configId = XboxLive.Instance.AppConfig.ServiceConfigurationId;
    
                    // OLD
                    GameSaveProviderGetResult result = await GameSaveProvider.GetForUserAsync(users[0], configId);
    
                    //// NEW (but not currently working)
                    //GameSaveProviderGetResult result = await GameSaveProvider.GetForUserAsync(SignedInUser.WindowsSystemUser, configId).AsTask();
    
                    if (result.Status == GameSaveErrorStatus.Ok)
                    {
                        _saveProvider = result.Value;
                        return true;
                    }
    
                    return false;
                }
                else
                {
                    Debug.LogError("Initialize Error: No Windows users found when creating save provider.");
                    return false;
                }
    

    Monday, January 29, 2018 3:44 AM