Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question Has anyone had success implementing Xbox Live (user sign-in, achievements, etc) in a UWP build?

Discussion in 'Windows' started by EmmetOT, Dec 2, 2021.

  1. EmmetOT

    EmmetOT

    Joined:
    Apr 25, 2016
    Posts:
    44
    Hello!

    I've been trying all week to get a UWP build of our game (using the most recent Unity LTS, 2020.3.23f1) which supports all the normal Xbox Live stuff, including user sign-in, achievements, and connected storage.

    We've already succesfully implemented this stuff for Xbox using XDK.

    However, I've been having a ton of trouble doing the same here.

    The first thing I tried was implementing this GitHub repo: https://github.com/microsoft/xbox-live-unity-plugin. However, I found it extremely difficult to use, with .dlls conflicting with existing plugins, incorrectly configured .dlls, build issues, etc. You need only look at the issues page on that repo to see I'm not the only one.

    I tried simply using the Xbox One code in the UWP app, but this doesn't work either. While it builds succesfully, I get in-game errors that the plugins (DataPlatform, Storage, etc) weren't found.

    I found this tutorial: https://docs.microsoft.com/en-us/gaming/xbox-live/test-release/live-port-xbl-code-from-xdk-to-uwp, which definitely seems like it's on the right track, but it's not Unity specific and requires installing a NuGet package...

    Which leads me to my last link! I tried to install the NuGet package found here: https://www.nuget.org/packages/Microsoft.Xbox.Live.SDK.WinRT.UWP/, but found the process of installing a NuGet package impossible. I tried this NuGet installer I found and I tried this obviously-outdated tutorial for installing them manually. Both of which were dead ends.

    I should add that I've searched this forum extensively: lots of information about building for UWP, not a lot of recent info on Xbox Live integration for UWP.

    So I feel like I'm out of ideas. I'm sure people have succeeded at this, but there is a surprising lack of recent information here on this forum or elsewhere. Does anyone have any tips? Thank you!
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,670
    Installing nuget packages should be as easy as opening the .nupkg file in 7-zip, and extracting the build folder. However, the package you linked just contains a bunch of C++ header files which aren't useful in Unity context.

    Good news is that one of the dependent packages (https://www.nuget.org/packages/Microsoft.Xbox.Live.SDK.WinRT.UWP.Netcore.Release/) seems to contain actual binaries:

    upload_2021-12-2_9-46-59.png

    you should be able to put them to a Unity project and use the .winmd file from scripts.
     
  3. EmmetOT

    EmmetOT

    Joined:
    Apr 25, 2016
    Posts:
    44
    Thanks for the reply, however just adding those .dlls/.winmds to my project doesn't seem to do anything. Is this the recommended way of adding Xbox Live support to UWP projects?

    How do I use .winmd files? I found this but the settings in my version of Unity are a little different, and the define directive returns false.

     
    Last edited: Dec 6, 2021
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,670
    The define directive returns false in the editor, but it will return true in the player. You don't need to change Api Compatibility setting with newer Unity versions (both of them will work). You can enable player project generation for intellisense purposes in Unity preferences:



    Then in Visual Studio, you can change the project context to "Assembly-CSharp.Player" and those defines should light up.