Exercise - Getting started with StereoKit

Completed

Now that we know a bit about what StereoKit is let's move on to the next step. We will start by installing the tools and pre-requisites to work with StereoKit. Next, this unit will teach you how to install StereoKit via the Visual Studio templates and enable Developer Mode on your device, PC, and HoloLens 2.

Here is a quick list of what is required to start developing with StereoKit:

  • Visual Studio 2019 or 2022 with the following packages installed,

    • .NET Desktop development
    • Universal Windows Platform development (for HoloLens)
    • Mobile development with .NET (for Quest)
  • StereoKit's Visual Studio Template

  • Any OpenXR runtime

    • A flatscreen fallback is available for development.
  • Enable developer mode (for UWP/HoloLens)

Install Visual Studio 2019

  1. Download the free edition of Visual Studio Community.

    The screenshot shows how to begin your download, by clicking the Free download button from Visual Studio Community.

  2. Save the Visual Studio installer to your device path. Once the download is complete, start the installation by running the Visual Studio installer.

  3. Once your Visual Studio starts to install, you'll see a few seconds of initialization followed by a feature selection option. First, select the .NET Desktop development and Universal Windows Platform development (for HoloLens) checkbox in Visual Studio 2019's features list. Then, after making the required selections, click the Modify button.

    Screenshot of how to select .NET Desktop development and Universal Windows Platform development (for HoloLens) in Visual Studio 2019.

  4. After you click Modify, Visual Studio proceeds to download and install the features you've specified. You'll be asked to Restart your computer when the installation completes. Next, launch your Visual Studio to verify the installation was successful.

    Screenshot of testing the visual studio launcher.

StereoKit's Visual Studio template

StereoKit's Visual Studio template is the quickest method to start a StereoKit project. By default, it has been set to copy project assets correctly and comes with some basic code that gives you some functionality to play around with right away.

There are two templates provided:

  1. Universal Windows Platform - is for HoloLens 2 and can also run on Windows desktop. However, UWP can be slower to compile and is no longer receiving updates from the .NET team.

  2. .NET Core - is used for desktop XR on Windows and Linux. It is simple to use, compiles quickly, and is the best option for most developers.

    Screenshot of downloaded stereoKit templates in Visual Studio.

  3. Native C++ Template (in development): StereoKit does provide a C API, but experienced developers should only choose this if the benefits outweigh the lack of C API documentation.

Note

Iteration is slower with Universal Windows Platform, so use it only if HoloLens is essential to you. Building for ARM instead of ARM64 can save some time, as it can skip the .NET Native compile required by ARM64. You may also skip the template and install the NuGet package directly into an existing project.

Download & install StereoKit's Visual Studio template

  1. Download the StereoKit templates from StereoKit Templates - Visual Studio Marketplace.

    Screenshot of StereoKit Templates - Visual Studio Marketplace.

  2. Open the downloaded file & click the Install button.

    Screenshot of VSIX installer dialogue box.

  3. Click close in the pop-up once the installation is complete.

    Screenshot of VSIX installer close button.

Enable developer mode

Enabling Developer Mode in HoloLens 2 & Windows PC makes it easier to test applications. This allows you to install Universal Windows Platform & Windows apps from outside the Windows Store, an essential feature for app developers who want to test their apps on PC while developing.

Enable developer mode for HoloLens 2

  1. Switch on your HoloLens 2 and put it on. Then, access the main menu using the start gesture.

  2. To start the app in your environment, select the Settings tile.

  3. Select the Update and Security option from the menu.

     The screenshot of Update & Security menu item.

  4. Select the menu item For developers.

  5. Enable Use developer features to deploy apps from Visual Studio to your HoloLens. If your device is running Windows Holographic version 21H1 or newer, enable Device discovery.

  6. Optional: Scroll down and enable Device Portal, allowing you to connect to your HoloLens Windows Device Portal from a web browser.

    Screenshot shows enabling the developer mode.

Enable developer mode for Windows PC

If you're using a Windows Mixed Reality headset with your PC, enable Developer Mode on your computer.

  1. Go to the Settings in the menu.

  2. Select Update and Security.

    Screenshot of Select Update and Security menu item.

  3. Next, select For developers.

    Screenshot of Select For developers option.

  4. Enable Developer Mode, read the disclaimer for the selected setting, then accept the change by selecting Yes.

    Screenshot of On the toggle button to enable Developer Mode.

In this unit, you have seen the pre-requisites for developing a Mixed Reality application using StereoKit. Next, you'll get an overview of the StereoKit Ink demo project as a simplified example of some of StereoKit's features and abilities.