Getting Started with StereoKit

The minimum prerequisite for StereoKit is the .NET SDK! You can use dotnet --version to check if this is already present.

If it is not, open up your Terminal, and run the following:

winget install Microsoft.DotNet.SDK.9
# Restart the Terminal to refresh your Path variable

On Linux, while the .NET version sometimes lags behind, many distros can do something like this: sudo apt-get install dotnet-sdk-8.0

With the .NET SDK installed, setting up a StereoKit project is quite simple!

# Install the StereoKit templates!
dotnet new install StereoKit.Templates

# Create a multiplatform StereoKit project, and run it
mkdir SKProjectName
cd    SKProjectName

dotnet new sk-multi
dotnet run

# For hot-reloading code, try this instead of `run`
dotnet watch

Native code developers can check out this guide for using StereoKit from C/C++.

Tools and IDEs

Once you’ve installed the templates via dotnet new install StereoKit.Templates, you have your choice of tools! Visual Studio 2022 will recognize the StereoKit templates when creating a new project, and the Command Line workflow works well with VS Code and other editors.

StereoKit is OpenXR based, so will work in any environment that supports OpenXR! On PC, this means you’ll want a desktop runtime such as SteamVR, Quest + Link, or Monado. If no OpenXR runtime is found, StereoKit will provide a nice Simulator that’s great for development! Some runtimes also provide a simulator for their platform, such as the Meta XR Simulator, so you can test their runtime without a headset.

Android

When using StereoKit’s sk-multi (multiplatform) template, deploying to an Android device is pretty straightforward! From Visual Studio 2022, you’ll need to set the SKProjectName.Android sub-project as your Startup Project (Solution Explorer->Right click on SKProjectName.Android->Set as Startup Project), and then you’ll have the option to deploy to any Android device connected to your machine.

From the command line, or VS Code, you have to run the Android flavored .csproj explicitly.

# From the same folder as above
dotnet run --project .\Projects\Android\SKProjectName.Android.csproj

Minimum “Hello Cube” Application

The template does provide some code to help provide new developers a base to work from, but what parts of the code are really necessary? We can boil “Hello Cube” down to something far simpler if we want to! This is the simplest possible StereoKit application:

using StereoKit;

SK.Initialize();
SK.Run(() => {
	Mesh.Cube.Draw(Material.Default, Matrix.S(0.1f));
});

Next Steps

Awesome! That’s pretty great, but what next? Why don’t we build some UI? Alternatively, you can check out the StereoKit Ink repository, which contains an XR ink-painting application written in about 220 lines of code! It’s well commented, and is a good example to pick through.

For additional learning resources, you can check out the SDK source, which does contain a number of small demo scenes that are excellent reference for a variety of different StereoKit features! You can also check out the Learning Resources page for a couple of repositories and links that may help you out.

And don’t forget to peek in the API docs here! Most pages contain sample code that illustrates how a particular function or property is used in-context. The ultimate goal is to have a sample for 100% of the docs, so if you’re looking for one and it isn’t there, use the ‘Create an Issue’ link at the bottom of the web page to get it prioritized!




Found an issue with these docs, or have some additional questions? Create an Issue on Github!