Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality. If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers. And always feel free to hit us up on Twitter @MxdRealityDev.

Building/Packaging Unity Immersive Apps

Hi all,

I've been working with Unity for a couple years now, but Mixed Reality was my first time building a Universal Windows Platform / Windows Store application using it. I had some trouble, and it took some trial and error, but I did finally get it to work, so I thought I'd share some of the details I found, in hopes of making this easier for others.

First, in Unity (2017.2.0b5 (or later), of course), go to File, Build Settings. Under Platform, choose Universal Windows Platform. For target device, choose "HoloLens" (note, I believe you should be able to use "Any" as well, but I wasn't able to get this to work). Build Type should be D3D, and for everything else, I believe the defaults are fine.

Now, when you press "Build", you won't actually be creating your executable, instead, you'll be making a Visual Studio project that you'll need to open that can build your executable. Go to the directory you picked for the build, and open the solution file found there.

Change the configuration to x64, and optionally, Release (or Master - that's the final / stripped version you can upload to the store), and make sure it builds. Note, you may have to install additional components of Visual Studio in order to make the projects in this solution load correctly.

Once the build is done, just going to the directory and running the executable will not work - you'll get two error messages about missing DLLs. The solution I found here (feel free to comment if you know of others!) is to build the package for your application.

In Solution Explorer, right click your project name (should have "(Universal Windows)" after it) and go to store, and pick "Create App Packages". Choose "No" to build packages to upload to the Windows Store (unless that's what you want and you're already a registered developer ($20 for an individual, $100 for a company, free if you're a MSDN subscriber)). Then continue on - the defaults are fine, though I generally leave only x64 checked for architecture.

The next window that appears when it finishes has a link to output location. Double clicking on your app will install it. If you get an error about a security certificate, go back to the folder and use the "Add-AppDevPackage" Windows PowerShell script that is in the directory. Right click, "Run with PowerShell" and it will take care of getting security certificate setup (with some prompting from you).

Once installed, you can go to the mixed reality portal and find your application in the list of all apps. Place it, and then select it to start it. If all goes well, your Unity project will start up and be running!

Again, I'm not an expert at this but - I hope this guide makes the process a little easier for people like me who have worked with Unity for awhile, but are inexperienced with this new build workflow. Good Luck. :)

Comments

  • Since I'm new to both Unity and the UWP, I appreciate this write-up. Thanks!

  • RitchieRitchie
    edited August 2017

    Some additional notes and options:

    • Set the UWP Player Settings->Unity Scripting Backend to .NET (not IL2CPP)
    • On the build settings, the (Target Device = Any Device) "should" work since you're really building a Desktop UWP app.
    • Unity Build-Run (CTRL-B) will also Build, Deploy and Run the Appx, the app will be in the list on the Mixed Reality Portal Menu.
    • If you opt to build the C# project, you can also Deploy and Run from Visual Studio without explicitly creating an app package
    • Unity Build-Run and Visual Studio Deployment handles the certificate dependency
  • Interesting, I was able to get things to work with the Scripting Backend of IL2CPP.

    When I used Any Device, the application would start up as a full screen / solid white window, floating in the cliff house, rather than going into immersive mode.

  • RitchieRitchie
    edited August 2017

    Thanks for the note on IL2CPP, I started experimenting with it again and it's a hit or miss case with me with it deploying and actually running, but with the latest setup (Unity 2017.2.0b5 + Win 16257.1) I finally get to experience an IL2CPP app run as long as I build as Master x64/x86 (following the Unity Build/Run descriptions.)

    My experience with Target Device = "Any Device" or "HoloLens" is the same on Mixed Reality Portal. On Menu App Selection, I get the App Startup Window for Placement, on placement you get the placeholder white window/rectangle in the start-up environment before it fades out and the app starts in full 3D/immersive mode.

    If you're getting stuck/hanging on the start-up environment, you can send system captures on the Windows Feedback Hub (set the category to Mixed Reality) so the product team can track the issue count.

  • Thank you both I am having issues getting my package to build with IL2CPP , I keep getting an error stating

    Error MSB8020 The build tools for v141 (Platform Toolset = 'v141') cannot be found

    I checked and in my VS2017 The recommended package of Desktop Development with C++ Tools has been downloaded. I am thinking I will try to rebuild using both of your recommendations but did either of you encounter this or a similar issue after getting your solution into Visual studio ? The main solution builds fine it's only when it tries to compile the IL2CPP solution that it seems to fall apart.

  • edited September 2017
    @EvoxVR - Is there a reason you need to use IL2CPP? It's not my recommended approach at this point.
  • @Jesse_McCulloch said:
    @EvoxVR - Is there a reason you need to use IL2CPP? It's not my recommended approach at this point.

    Hi Jesse if I select .Net as my scripting backend instead of IL2CPP I receive the following error :

    : error CS0234: The type or namespace name 'X509Certificates' does not exist in the namespace 'System.Security.Cryptography' (are you missing an assembly reference?)

    I think it is an issue having to do with the internal .net used by unity which never seems to be on par with the latest officially released Microsoft versions of dotnet. Thankfully I have had better luck , I switched my version of visual studio 2017 community to Visual Studio 2017 enterprise and I just managed my first successful build for the Mixed reality headset. I am not sure if it was an error caused by the version of VS I was using or just a clean install of VS2017 helped. regardless it seems to have worked thus far.

  • You may have gotten a newer version of the Windows SDK as well with the install. Hard to say. Glad you got a successful build.

  • DandoDando
    edited May 2018

    Hi all,
    Thanks, Jerrith for your walkthrough, proved to be useful.

    When attempting to run my Mixed Reality App it launches in the cliff house as a floating blank window (see picture - this is probably because I have not added the artwork for the splash screen etc..).

    When I select it all I get is a black screen. Any thoughts on the cause of the black screen when selecting?
    ?

Sign In or Register to comment.