Search Unity

Tips and Tricks for Building for UWP and deploying to Xbox One

Discussion in 'Windows' started by schmosef, Apr 1, 2016.

  1. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    For what it's worth, one of the known issues in the current version of the preview is that switching build type causes problems, and their current recommendation is to not do it.
     
  2. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Returning to my adventures, 2 of the three projects I've tried work nicely as soon as I've removed APIs that aren't compatible (social platforms not available on the Xbox and such).

    My other project... not so much.

    @Tautvydas Zilys, any ideas on what I'm missing? It seems really strange to me that it's failing to find a built-in system library.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    Can you attach relevant parts of editor log?
     
  4. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    I think this is the relevant part.
     

    Attached Files:

    • log.txt
      File size:
      5.6 KB
      Views:
      1,054
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    I was hoping to see the list of assemblies you have in your project.

    Either way, IL2CPP targets .NET 3.5 like the rest of the Unity platforms, and unlike .NET scripting backend, which targets .NET Core 5. One of the assemblies in question is referencing System.Runtime.dll, which is part of .NET 4+, that's why IL2CPP cannot find it.

    I believe this happens because you have some plugin in your project that has a special version of it for .NET scripting backend (probably in the directory of Assets\Plugins\Metro or Assets\Plugins\WSA), which did not anticipate IL2CPP scripting backend. The solution should be pretty straightforward: mark these plugins as only compatible with .NET scripting backend in the plugin inspector and mark the ones that are for editor and all other platforms as compatible with Windows Store IL2CPP scripting backend.
     
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Ahh, of course.
    Code (csharp):
    1.  
    2. Mono dependencies included in the build
    3. Dependency assembly - DialogueSystem.dll
    4. Dependency assembly - LuaInterpreter.dll
    5. Dependency assembly - Rewired_Core.dll
    6. Dependency assembly - Rewired_Windows8Store.dll
    7. Dependency assembly - RAIN.dll
    8. Dependency assembly - RAINMetaform.dll
    9. Dependency assembly - Boo.Lang.dll
    10. Dependency assembly - UnityEngine.UI.dll
    11. Dependency assembly - UnityEngine.Networking.dll
    12. Dependency assembly - Assembly-CSharp-firstpass.dll
    13. Dependency assembly - Assembly-CSharp.dll
    14. Dependency assembly - Assembly-UnityScript.dll
    Though I should be able to figure it out based on the rest of your post anyway.
    *facepalm*
     
  7. Spabbage

    Spabbage

    Joined:
    Feb 15, 2015
    Posts:
    37
    Does anyone know of a way of determining if code is running on Xbox or PC? Normally I'd use platform constants but UNITY_WSA_10_0 applies for both.
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    Why do you need to know whether you're running on xbox or PC?
     
  9. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Quit button? They're expected for PC games, not so much for console games. Might want to give PC gamers more options, too.
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,905
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    You could hardcode device model, but that'd be a brittle hack.

    Do you think there's harm in having a quit button or graphical settings on xbox? Do you think it's unfair to have people choose to play at higher graphical fidelity or higher frame rate? I don't play on consoles myself, but that seems like a logical thing to do :).
     
  12. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    It's not about "fair", it's about expectations. Except for the bits of my game that are deliberately unique (art, mechanics, etc.) I want my game to look, feel and behave exactly like every other game on its platform.

    If other games don't have a quit button, I shouldn't have one either.

    Console games are expected to be ready-to-go once the game loads. Options are limited to usability stuff like subtitles, because we're expected to have handled the technical stuff. (After all, we're targeting a theoretically fixed hardware device plugged into standardised peripherals). PC gamers expect more technical options, partly because we can't pre-tune our game for every PC configuration but also partly because some people like tweaking them.

    There's other stuff as well. Got a tutorial in your game? On a console you want to be showing specifically what buttons to press on the official controller. On PC you might instead want to refer to user defined control mappings, or do a lookup if you recognise the controller that's plugged in. Both are easy, but you still need to know which one to do...

    So in short, yes, there are cases where it'd definitely be helpful to have an easy way to identify the difference between a console and a PC. That said, I don't know the expectations for any of the above for a UWP app. Since they're meant to be cross-platform then the expectations could well be different to that of console native titles.
     
    Peter77 likes this.
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    Fair enough.
     
    angrypenguin likes this.
  14. Katastrophe1986

    Katastrophe1986

    Joined:
    Apr 21, 2016
    Posts:
    6
    Very nice manual for getting started you've made here.


    I was wondering if anyone has run into an issue where when you build your UWP app, even from Unity itself, nothing works unless I hover the mouse over the window. I have a game object set as the first selected in the event system for that scene but even that isn't showing until I hover the mouse over the window.
     
  15. Katastrophe1986

    Katastrophe1986

    Joined:
    Apr 21, 2016
    Posts:
    6
    To fix my issue there is an option in the stand alone input module to force active.
     
  16. jammyt

    jammyt

    Joined:
    Jul 7, 2014
    Posts:
    12
    Hi, thanks for the instructions on how to get this working. I've been following the instructions and have built my game from Unity, opened in VS2015 (SP2) and am now on point 9) to 12) trying to get it to run locally.

    When I build the project it builds fine but when I hit CTRL + F5 to test I get this error:

    1>Registering the application to run from layout...
    1>Checking whether required frameworks are installed...
    1>Copying files: Total 183 mb to layout...
    1>Creating a new clean layout...
    1>DEP0700 : Registration of the app failed. error 0x80070003: Opening file from location: AppxManifest.xml failed with error: The system cannot find the path specified.

    I've tried googling but I can't find anything. I've tried debug / release / master (making sure to clean before building) but it gives the same error.

    Any ideas would be gratefully received as I'm really not sure what I've done wrong.
     
  17. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    I think this is the key to your issue:

    Open the AppxManifest.xml file and look at the path it is trying to use.

    More than likely, you have a special character in the path string (Visual Studio does not like special characters, like "&", to be in the path string) or the path could just be too long.

    It could be a file permission issue on the path.

    Bottom line is it can't find the file.

    See if you can fix the path string in the AppxManifest file.

    If not, you might need to create/build your project in a simpler path.

    You might have anti-virus software blocking access to the file.
     
    Last edited: Apr 29, 2016
  18. jammyt

    jammyt

    Joined:
    Jul 7, 2014
    Posts:
    12
    Thanks for for help. I'm not at my PC right now but where does the AppxManifest.xml file live? I couldn't see it on my computer last night, I had a package.appxmanifest file is that the same thing?

    When I opened the package.appxmanifest in Visual Studio I was able to see a setup for Path but it was empty. That's probably where it's going wrong but I didn't know where to set the path as I couldn't see the xml file anyway.

    I don't think I have any special characters in my path name, but I am using a mapped drive (S:/ maps to my SVN root location). I'll try it later with a standard location and see if that works.
     
  19. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Sorry, I need to clarify a few points.

    The AppxManifest.xml file is created in the build process. Your error is saying that it cannot file the AppxManifest.xml file.

    After a successful compile, you should be able to find it in the "bin" folder hierarchy of your project. It will be in the sub folder named after your build type (e.g., [project folder]\bin\Master).

    Somehow, the file is either not being created, not being included or not being found when VS tries to compile, deploy and run your project.

    This type of issue is actually pretty common. It almost always comes down to a problem with the project path:
    • The path string contains a character that VS does not like;
    • The path is too long;
    • VS does not have the necessary file permissions;
    • Some other process, like a virus scanner, is blocking VS from accessing the file(s).

    You mentioned that you are running the project from a mapped path. I think VS is having trouble with file permissions:
    1. Move your Unity project to a path on a local drive.
    2. Open the Unity project and re-export the UWP project, again to a local path.
    3. Open and run/deploy the UWP project in VS.
    There is a good chance that this will work.
     
    Last edited: Apr 30, 2016
  20. jammyt

    jammyt

    Joined:
    Jul 7, 2014
    Posts:
    12
    Great, thanks for your help! Finally got time to try it again. I built the Unity project to a folder near the root of my C: drive, C:/UWP Builds and it worked fine building and testing locally.

    Now to try out the build on my Xbox One (via wireless)...
     
    schmosef likes this.
  21. jammyt

    jammyt

    Joined:
    Jul 7, 2014
    Posts:
    12
    Got it working on my Xbox One via wireless, you need to setup your wireless connection again when going into DevMode. That confused me for a good 5 minutes ;-)

    Now to work out why my pad input isn't working.
     
  22. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Alright, back to this!

    I sorted out the compile time errors, it was a couple of Editor plugins that had code in places that got included in builds. They don't cause problems for other platforms, but they do here. At least now I know what it is.

    I still have some issues with failures that don't give error messages on the VS side of things. Hopefully that's something they'll get resolved during this "Preview" period.

    Edit: Oh yeah, I feel I should say that when I don't run into silent build errors my larger game does build and deploy now. After solving those intermittent deploy issues the next thing I'll work on is getting the Profiler to connect, as performance in our game (it's a prototype/demo - nothing is optimised at all) is alright but not great. That said, based on what I've seen here you should be able to do some pretty impressive looking stuff even within the UWP limitations.
     
    Last edited: Jun 2, 2016
    schmosef likes this.
  23. thestringer

    thestringer

    Joined:
    Aug 7, 2014
    Posts:
    70
    Okay so can get my game sort of running but little odds and ends of problems.

    I've tried to have a look for the bottom line in the UWP platform - Am I right in thinking that one build is for all Win 10 Devices Phone/tablet/desktop/XBOX One ? or can I single out just Desktop & the One ?

    Issues that I've had so far are:

    Deploy on X1 - Bit hit and miss but clean then remote machine and clean every time I want to deploy.
    X1 Dev Kit is a bit iffy get VS Error complaining about certificates

    Only way I've got round it is to reboot the XBOX a few times.

    However like mentioned in another post it is amazing to see your game on the XBOX and boy is it smooth!





    ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==================== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========3>------ Deploy started: Project: RaceOne X, Configuration: Master x64 ------2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1908,5): warning APPX0107: The certificate specified is not valid for signing. For more information about valid certificates, see http://go.microsoft.com/fwlink/?LinkID=241478.2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(1908,5): warning APPX0105: Cannot import the key file 'WSATestCertificate.pfx'. The key file may be password protected. To correct this, try to import the certificate manually into the current user’s personal certificate store.2>MakePRI : warning 0xdef00520: Invalid qualifier: DLL-RESOURCES
     
  24. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Is it possible that you missed step 4 in my guide?

    I've run into this type of certificate error during deployment when I forget to create a test certificate.

    Usually, the first deploy works but any deploy after that will fail. Then I remember to create a test cert and deploys will work again.

    Even if you did create a test cert, I would try creating a new one and re-building the UWP project from Unity.
     
    Last edited: Jun 3, 2016
  25. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    You are right that UWP is for all Win 10 devices by default.

    For info on how to restrict your app look under "Excluding support for a particular version of a device family" in Microsoft's official Guide to Universal Windows Platform (UWP) apps.
     
  26. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    That is your choice when you submit your game to the Windows Store: there isn't a way to limit it technically, but if you don't select it to be available for mobile when submitting, nobody on mobile will be able to download it.
     
    thestringer likes this.
  27. thestringer

    thestringer

    Joined:
    Aug 7, 2014
    Posts:
    70

    Thanks !!! Oh Is it possible that you missed step 4 in my guide? Yes this was a problem , re did the cert again but...

    led on to other issues but prob because of something I've missed

    "unable to activate Windows Store app" Failed with error "package failed updates. dependency or conflict validation " when deploying to the X1.
     
  28. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    You probably have to manually delete the old instance of your app from the X1 before you can deploy with the new test cert.

    If that doesn't work, reboot into retail mode, then reboot into dev mode and try to deploy again.
     
  29. thestringer

    thestringer

    Joined:
    Aug 7, 2014
    Posts:
    70
    Yes deleted from X1 & Cleaned then worked again!

    under Properties>Debug there is a option for Uninstall and then re-install

    But alas this does not work.

    So .... XBOX One > My Stuff > Apps > Delete Current install of game
    Then
    Unity (Make sure Cert is created) >Build> VS > Clean > Remote machine > Done

    Problems
    Wifi drops connections but does work when deployed - Wired will be best

    Tried Wired XBOX - WiFi Mac(Bootcamp) - works
    WiFi XBOX- WiFi Mac(Bootcamp) - sometimes works

    XBOX DEV (March) will sometimes just not open your game - just keep trying and it will load

    Overall it's cool!!!
     

    Attached Files:

    • x1.jpg
      x1.jpg
      File size:
      912.2 KB
      Views:
      940
    schmosef likes this.
  30. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    That's meant to work, but I couldn't ever get it to work with a password. I found a bunch of people with similar problems discussing solutions, but after a couple didn't work for me I just made a new certificate without a password. (Not ideal, of course!)
     
  31. thestringer

    thestringer

    Joined:
    Aug 7, 2014
    Posts:
    70
    Weird thing is I am finding updating Game on XBOX is just weird.

    New install to xbox - OK
    power off Xbox & back on again
    Install update - OK

    If Install run then update again results in failed, must be a Dev software thing on Microsofts part
     
  32. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    That's my guess, as I've been seeing similar things. It is a "Preview" of the system, so I wouldn't necessarily expect it to be especially robust yet.
     
  33. elettrozero

    elettrozero

    Joined:
    Jun 19, 2016
    Posts:
    216
    What SDK and what target has been used in success cases?
     
  34. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Last edited: Jun 19, 2016
  35. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    1,027
    First of all, great post!
    Lots of great technical information here about how to get things connected up and running.
    I was able to get my hello unity app running on my XBox One no problems.
    However, being that I normally make Unity stuff for traditional OSX/Windows builds, I am at a bit of a loss of where to start with writing content for the XBox One.

    In terms of things like character movement, I guess I can just use the normal Input classes in unity as mapped out to the XBox One controller?

    There is also an asset Im looking at (https://www.assetstore.unity3d.com/en/#!/content/54715) which exposes some native things, but I recall from doing some PSN development in the past that there were special things you needed to do from Unity in order to access platform specific things like the save system, achievements, etc...

    All of that being said, has anyone seen/written a guide for writing specifically for XBox One (not so much UWP)?

    I hope my questions don't seem too n00bish.

    [edit]
    Also, I dont suppose that Cloud Build is setup to allow direct publish/deploy to XBox One?
    I know it supports "Windows Desktop", but that should not be read as UWP right?
     
    Last edited: Jun 20, 2016
    schmosef likes this.
  36. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    You shouldn't view it as developing for XBOX One - you should view it as developing for UWP. Developing for native Xbox one is a little bit different, as a lot of the things don't apply when deploying to it using UWP path. When deploying applications to xbox as UWP, you won't need to do anything special for running it on xbox: the API surface is identical for all UWP devices and if it works on one of them, it should work on all of them.

    That is correct; cloud build does not support UWP yet.
     
  37. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    852
    Glad it helped.
     
  38. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    1,027
    OK, So I should focus my efforts on understanding the Nuance of UWP then.
    Perhaps My google foo is lacking, but is there a place that discusses the limitations of UWP and Unity?
    For example, like with WebGL, there are just things that you can't do as you would on a native build.

    Thanks,
    John
     
  39. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    JohnRossitter likes this.
  40. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    1,027
    Cool, yeah I read through all of that last night, was just confused about the UWP portion of it.
    The limitations all seem livable to me.

    I did read somewhere about the XBOX throttling the UWP apps access to the CPU.
    I guess this is the kind of stuff Im wanting to know about. If I will have major bottlenecks that will prevent a game from being developed on UWP for XBOX.

    Thanks,

    [edit]
    I think this is what I was looking for:
    https://msdn.microsoft.com/en-us/windows/uwp/xbox-apps/system-resource-allocation
     
    Last edited: Jun 20, 2016
  41. JohnRossitter

    JohnRossitter

    Joined:
    Dec 18, 2013
    Posts:
    1,027
    I wanted to share my experience with this.
    So, after much playing around I kept getting really low frame rates on my console.
    The magic bullets for me were:

    Deferred/Linear/Baked Occlusion Culling/ D3D/ IL2CP/ Release Mode from Visual Studio.
    With these settings I was hitting a SOLID 60 FPS on the console.
     
    schmosef likes this.
  42. Andrew-Kite

    Andrew-Kite

    Joined:
    Oct 16, 2014
    Posts:
    34
    @Tautvydas Zilys, I have actually been wondering about this since I am currently planning iAP and Analytics. So really these systems (Unity iAP and Analytics) should work on Xbox One when it gets support for Universal Windows apps correct? Just triple checking before I go any further :)
    And if so, I may as well ask here while I'm at it, is Unity looking into adding filter support for Xbox in Unity Analytics in the future by any chance?
     
  43. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    If it works on other Universal Windows Apps platforms, it should work on Xbox One running as Universal Windows application. Last time I checked, Analytics worked already, and IAP worked on .NET scripting backend.

    Could you elaborate what you mean by filter support?
     
  44. Andrew-Kite

    Andrew-Kite

    Joined:
    Oct 16, 2014
    Posts:
    34
    Awesome, and by filters I meant being able to distinguish data collected by an Xbox platform. So as it is currently, I am able to set up filters on the Unity Analytics web page to determine installs on Windows 10 desktop or mobile, and am hoping that in future Xbox may be an additional option.
    Thanks for the clarrification.
     
  45. markychoi

    markychoi

    Moderator

    Joined:
    Aug 4, 2014
    Posts:
    40
    Hi Andrew,

    Currently Unity Analytics does not support analytics for the native Xbox platform, although we are in the middle of exploring ways to add analytics support for it.

    We do however provide analytics support for Universal Windows Apps, and your comments have brought to our attention this news of Xbox working with Universal Windows Apps.

    We're going to do some additional investigation and run some tests, and we'll get back to you soon with answers regarding filtering!
     
    Andrew-Kite and schmosef like this.
  46. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    Hello,


    I am encountering the following popup error window when VS tries to deploy to my Xbox One:

    Unable to activate Windows Store App
    The activation request failed with error 'Operation not supported. Unknown Error: 0x8710008'

    Any suggestions on how to fix that?
    (have already tried rebuilding from scratch from Unity, cleaning project in VS, revoking and reenabling developer license, restarting pc and xbox)

    Thanks a lot in advance.


    Uffe Flarup
     
  47. Panda-Studio

    Panda-Studio

    Joined:
    Apr 29, 2014
    Posts:
    2
    When I load my game on the xbox something very strange happens. It looks like the screen resolution change to 1080x1910. And leaves the almost the halft of my screen black.

    I am useing unity 5.4 and D3D.
     
    Pendrokar likes this.
  48. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    @Panda.Studio : I'm experiencing the exact same problem with my builds, after the latest update to the Dev Mode app. It happens when I "minimize" the app using the home button on the controller, and then afterwards I go back into the app again. It doesn't happen on the initial launch.

    With respect to my previous "Unable to activate Windows Store App" post, then that was fixed by logging into a Microsoft account after booting Xbox up in dev mode. For more info see this: https://msdn.microsoft.com/en-us/windows/uwp/xbox-apps/known-issues?f=255&MSPPError=-2147217396
     
    Pendrokar likes this.
  49. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    Do you have the build set to run in landscape mode in the Player Settings? Remember that UWP is a cross-platform build target, so it has a bunch of tablet/mobile options in there as well. (You'll see similar things if you set an OUYA/other Android console game to run in portrait on a TV.)
     
  50. Flarup

    Flarup

    Joined:
    Jan 7, 2010
    Posts:
    164
    @Panda.Studio @angrypenguin : With respect to the "half the screen black" problem, then I have tried setting Display Orientation to both Landscape Left, Landscape Right and Auto, but none of them helps. When the game launches the Unity splash screen appears correctly centered after some seconds, but shortly after the splash screen changes position. The "new" position of the splash screen is something that "looks like" it would be correct IF I had set Display Orientation to be Portrait (which I haven't). So it looks like orientation is changed from landscape to portrait while the splash screen is displayed.
     
    Pendrokar likes this.