.net, HoloLens, Unity, UWP

Coding for the HoloLens with Unity 5 – Part #7 – Creating a basic HUD

One of the elements of augmented reality that’s probably most widely known is a HUD – this is a Heads Up Display. If you’ve played an FPS computer game you’ll be familiar with this as the area of the screen that shows your health, or score, or the number of lives you have left in the game.

This isn’t really a hologram as such, but it’s still something we can develop for the HoloLens. The key is making sure the artefacts rendered by the HoloLens are kept in the same position in front of you – and essentially, it means making those artefacts child objects of the camera.

Let’s have a closer look.

Keeping an object in one place

I’ll demonstrate the principle of keeping an object in one place in the steps below – later we’ll look at how to render text.

First, create a new project in Unity for the HoloLens (I’ve previously described how to do this here).

screenshot.1472152960

Next, right click on the Main Camera object in the Hierarchy. Add a new Cube GameObject.

screenshot.1472153013

Change the position of this Cube object so that it’s 2m in front of you, and scale it to 0.1 of its original size. This should be a white cube, sitting 2m in front of the camera, which has sides of about 10cm in length.

screenshot.1472153122

If you now build this project and deploy it to the emulator, you’ll see a white cube as described above. If you try to move around in the emulator, nothing will happen (apparently). This is because the cube is in a static position in front of the camera, so even though you are moving, the cube moves with you.

screenshot.1472157675

Let’s prove this by adding another object. This time, add another cube to the main Hierarchy panel, but not as a child of the camera object. Make it 2m in front of you and 1m to the left, resize it to 0.1 scale, and add a material to colour the cube red (I write about how to change an object’s colour here).

screenshot.1472157923

Again, build this project, deploy to the emulator, and try to move around. This time you’ll be able to look around the red cube and move your position relative to it, but the white cube will stay in the same spot.

screenshot.1472159248

If you have a HoloLens, try deploying to the HoloLens and you’ll be able to see this more clearly – whereas you can walk around the red cube, the white cube stays still in front of you.

A more useful example

So having a white cube as a HUD isn’t very useful – but that was just to demonstrate how to keep an object in a static position in front of you. Now, let’s look at adding some text to our HUD.

Open the HUD project again, and remove the white and red cubes we created in the last step.

Now add a canvas object as a child of the Main Camera – this is available by right clicking on the Main Camera, selecting UI from the context menu, and then selecting Canvas from the fly-out menu.

  • Position the Canvas to be 1m in front of you – meaning change the Z position to be 1.
  • Change the width to 460, and height to 280.
  • Change the scale to be 0.001 for the X, Y and Z axes.
  • Also, change the Dynamic Pixels per Unit in the Canvas Scaler component from 1 to 10 (this makes the text we’ll add later less blurry).

screenshot.1472338895

Next, add a Text GUI object as a child of this Canvas object (this is also available from the same UI menu).

  • Position this to be in the top left of the canvas using the Paragraph -> Alignment options.
  • Change the text to “Top Left”.
  • Change the font to be 14.
  • Change the colour to be something distinctive. I’ve used green in my example.
  • Make sure the positions in the X, Y and Z axes are all zero, and that the scales are all set to 1.
  • Finally, in the Text object’s Rect Transform component, ensure that the object is set to stretch in both vertical and horizontal directions.

screenshot.1472339683

Now build your project, and deploy it to the emulator.

This time, you should see some green text floating in the top left corner of your field of view.

screenshot.1472339239

If you can’t see this text, change the position from top left to centre – it may be the you need to adjust the canvas dimensions to be different from mine.

You can take this a bit further as I’ve shown in the picture below, where you can align text to different positions on the canvas.

screenshot.1472339560

This is a very powerful technique – you can use scripts to adjust this text depending on actions in your surroundings. Also, you aren’t constrained to just using text objects – you could use an image, or something else.

Hopefully this is useful inspiration in creating a HUD for your HoloLens.

.net, HoloLens, Unity, UWP

Coding for the HoloLens with Unity 5 – Part #5: Creating holograms from prefabs at runtime using gestures

Up to now in this series, I’ve added holograms to my scene within Unity. But it’s much more useful to be able to create holograms at run-time. This tutorial will show how to create a pre-fabricated object (called a prefab) in Unity, and how to use a simple tap gesture to add this hologram prefab to your scene.

Creating a pre-fabricated object in Unity

Unity has an asset type called prefab. This allows a GameObject to be created as a kind of global project asset which can be re-used numerous times in the project. Changing the prefab asset in one place also allows all instantiated occurences of the asset in your scene to change also.

Let’s create a simple object in a project hierarchy, and convert it to a prefab asset.

First, in a Unity project, right click on the Hierarchy surface and create a new Cube 3d object – call it “Cube”.

Next, right click on the Asset node in the Project surface, create a new material (the picture below shows how to select Material from the context menu). Call the material “Blue”.

screenshot.1469374606

For this material, selected the Albedo option and from colour chooser palette which appears, select a blue colour.

screenshot.1469374837

Now drag this material onto the “Cube” object in the Hierarchy view. The cube which is in the centre of the scene should now turn to a blue colour.

screenshot.1469375525

Next, right click on the Assets node in the Project view, and select the Create item in the context menu. From this, select the Prefab option.

screenshot.1469375699

Call this prefab object “BlueCube”. This will have the default icon of a white box.

screenshot.1469376023

If you now click on the Cube in the Hierarchy view, ou can drag this onto the BlueCube prefab object. The icon will change from a white box to a blue box, previewing what the object looks like in our virtual world.

screenshot.1469376154

You have now created a prefab object – whenever you want to create a BlueCube object like this in your scene, you can just use the prefab object, instead of having to create a cube and assign a material to it each time. Additionally, if you want to change the object in some way – for example to change the size, orientation, or shade of blue – you can change the prefab object, and this change will be reflected across all instantiations of this prefab.

How can we create a prefab hologram at runtime?

Let’s start by deleting the cube object from the scene. Either click on the cube in the scene, or click on the “Cube” object in the Hierarchy view, and hit delete. The scene will now be empty.

Now let’s create a new C# script to help us manage creating holograms. Right click on the Assets panel, and create a new C# script called “CubeManager”. Now double click on this script to open up your preferred script editor (e.g. MonoDevelop or Visual Studio).

There’s two things I want to do in this script – I need to capture a tap gesture, and when I detect a tap, I want to instantiate a “BlueCube” object 2m in front of where I’m presently looking.

First, add a public member GameObject variable to the CubeManager script called blueCubePrefab, as shown in the code below:

public class CubeManager : MonoBehaviour
{
    public GameObject blueCubePrefab;
}

Now we have to let our scene know about this script. Switch back to Unity, and right click on the Hierarchy panel – from the context menu, select “Create Empty”. Give this object the name “BlueCubeCollection”.

Drag the “CubeManager” C# script to the new “BlueCubeCollection” object. On the Inspector panel for the BlueCubeCollection object, you’ll see a new script property called “Cube Manager”.

screenshot.1469379685

Notice in the diagram above that the Cube Manager script has a variable called “Blue Cube Prefab”. Unity has created this property based on the public GameObject variable called “blueCubePrefab” in the C# script.

But also notice that the property has a value of “None” – whereas there’s a declaration, there’s no instantiation. We can fix this by dragging the BlueCube prefab we created earlier onto the textbox that says “None (Game Object)”. When you do this, the panel will change to look like the diagram below – notice that it now says “BlueCube” below.

screenshot.1469379987

Let’s go back to the C# script. In order to recognise gestures like a tap, the script needs to have a GestureRecognizer object. This object has an event called “TappedEvent”, and when this event is registered, we can start capturing gestures. The code below shows how this works.

using UnityEngine;
using UnityEngine.VR.WSA.Input;

public class CubeManager : MonoBehaviour
{
    public GameObject blueCubePrefab;
 
    GestureRecognizer recognizer;
 
    void Start()
    {
        recognizer = new GestureRecognizer();
 
        recognizer.TappedEvent += Recognizer_TappedEvent;
 
        recognizer.StartCapturingGestures();
    }
 
    private void Recognizer_TappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
    {
        // process the event.
    }

The last part of this is instantiating the new BlueCube object at a specific location. The key to this is the parameter headRay in the Recognizer_TappedEvent above. This headRay object has a couple of properties, which will help us position the new object – the properties are direction and origin. These are both of the type Vector3 – this object type is used for passing positions and directions.

  • headRay.origin gives us the position that the HoloLens wearer is at.
  • headRay.direction gives us the direction that the HoloLens wearer is looking.

Therefore, if we want to get the position 2m in front of the HoloLens, we can multiply the direction by 2, and add it to the origin value, like the code below:

var direction = headRay.direction;
 
var origin = headRay.origin;
 
var position = origin + direction * 2.0f;

So now we have the position where we want to place our hologram.

Finally, we just need the code to instantiate the blueCubeFab hologram. Fortunately, this is very easy.

Instantiate(blueCubePrefab, position, Quaternion.identity);

This call places an instance of the blueCubePrefab at the Vector3 position defined by position. The Quaternion.identity object simply means that the object is in the default rotation.

So the complete code for the CubeManager is below:

using UnityEngine;
using UnityEngine.VR.WSA.Input;

public class CubeManager : MonoBehaviour
{
    public GameObject blueCubePrefab;
 
    GestureRecognizer recognizer;
 
    void Start()
    {
        recognizer = new GestureRecognizer();
 
        recognizer.TappedEvent += Recognizer_TappedEvent;
 
        recognizer.StartCapturingGestures();
    }
 
    private void Recognizer_TappedEvent(InteractionSourceKind source, int tapCount, Ray headRay)
    {
        var direction = headRay.direction;
 
        var origin = headRay.origin;
 
        var position = origin + direction * 2.0f;
 
        Instantiate(blueCubePrefab, position, Quaternion.identity);
    }
}

Now we can build and run the project using the settings defined in my other post here. After running the project in Visual Studio through the HoloLens emulator which showed an empty scene, I created a few boxes (using the enter key to simulate an air-tap). I’ve navigated to the side to show these holograms.

screenshot.1469385281

So now we know how to create holograms at run-time from a prefabricated object using a gesture.

 

.net, HoloLens, Unity, UWP

Coding for the HoloLens with Unity 5 – Part #4: Preparing the Unity project for source code management

This will be a super short post, but something that I thought deserved its own post.

One thing I’ve noticed with Unity projects is that, by default, some of the files are created as binary files – for example, files in the “ProjectSettings” folder. This isn’t great for me if I want to commit files to GitHub or Subversion. I prefer to check in text files, so if a file changes, at least I can understand what changed.

To ensure files are generated as text, open the Unity editor, and go to Edit -> Project Settings -> Editor, which will open an Inspector panel in the Unity editor (shown below).

screenshot.1468703470

I’ve highlighted the values I changed in red above:

  • I’ve changed the default version control mode from Hidden Meta Files to “Visible Meta Files” – this means each asset (even binary) has a text file containing meta data, which is available through the file system. More information is available at this link.
  • I’ve also changed the Asset Serialization Mode from “Mixed” to “Force Text”.

After restarting Unity, you should notice that project settings and assets (such as prefabs) are now text files. I think this is more suitable for management in a code versioning system.

The only folders that I commit in my project are the “Assets”, “Library” and “ProjectSettings” folders. I choose to add all other folders and files to the ignore list.

.net, HoloLens, Unity, UWP

Coding for the HoloLens with Unity 5 – Part #3: Deploying to the emulator (and using it)

Last time, I created a simple Hello World project in Unity 5 for the HoloLens. This time, I’ll deploy it to the HoloLens Emulator.

There’s a few other things I’ll look at as well – how to use the Emulator from your keyboard, and some hints on setting up your Unity HoloLens project for a code versioning system.

Building your Unity HoloLens project

Now that we have created and saved our Unity project, we’re ready to deploy it to our HoloLens. Inside the Unity environment, open the File menu and select “Build Settings…”.

screenshot.1468616434

This will open a screen similar to the one below. I’ve modified some of the settings:

  • I clicked on the “Add Open Scenes” to add the default “Hello World” scene;
  • I selected the platform “Windows Store”;
  • I’ve changed the SDK to “Universal 10”;
  • I’ve changed the UWP Build Type to D3D;
  • Finally I’ve checked the box beside “Unity C# Projects”.

screenshot.1468616326

Next, click on the button saying “Player Settings…” – the Inspector view will appear on the main Unity development environment.

screenshot.1468618370

The most important property page is “Other Settings”. Make sure that the “Virtual Reality Supported” box is ticked, and that the value under “Virtual Reality SDKs” is “Windows Holographic” (I’ve highlighted this in red below).

screenshot.1468618700

Now click on the “Build” button on the “Build Settings” window, which should still be on top of the Unity IDE. You’ll immediately be shown a folder dialog box, asking you to select a folder in which to create the Visual Studio project. I normally choose to create a folder named “App” alongside the other folders in the Unity Project. Choose this folder and hit the “Select Folder” button.

screenshot.1468619335

A few windows will pop up showing progress bars, and eventually a Windows Explorer window appears with the folder “App” selected. I opened the “App” folder, and double clicked on the “HelloWorld.sln” file, to open the solution in Visual Studio 2015.

Deploying to the emulator

When Visual Studio opens, ensure that the “Release” configuration is chosen, targetting the x86 architecture. I’ve selected the HoloLens Emulator as a deployment device, rather than a HoloLens.

screenshot.1468620806

After clicking on the button to start the HoloLens Emulator, the emulator starts but I see a warning message (shown below).

screenshot.1468621830

I select “Continue Debugging”, and the application starts in the emulator, showing a sphere orbiting the planet.

screenshot.1468622276

Using the emulator

The emulator is obviously not a perfect substitute for the real HoloLens hardware, though it’s still pretty good. One of the things I initially found difficult was how to navigate around the virtual world. If you’re familiar with gaming on a keyboard you’ll probably find it quite easy – forward, back, left and right can be controlled by W,S,A and D, and looking up, down, left and right can be controlled by the corresponding keyboard arrow keys.

I personally don’t really like using the keyboard to control the emulator, and fortunately an alternative option is to connect an Xbox 360 controller to my PC by USB – I find the game controller a much easier way to navigate in the virtual world.

There’s a set of instructions on how to use the emulator at this link, and full details on advanced emulator control at this link.

The emulator even offers an online device portal, available by clicking on the globe icon in the list of icons on the top right of the emulator – this just opens up a site in a browser, as shown below. There’s more information on how to use the device portal at this link.

screenshot.1468700023

All the information and functions available through the device portal are also available through a RESTful API – so for example, to see the device battery status, you can browse to:

http://<your device’s IP address>/api/power/battery

and the response will be a JSON representation of your battery status.

Full details of the RESTful API are available at this link.

Wrapping up

So in the last three posts, we’ve:

We’ve also looked at how to use the emulator, and how to see its Device Portal.

Next time, I’ll look at preparing our code for a code versioning system such as Subversion or GitHub.

.net, HoloLens, Making, Unity, UWP

Coding for the HoloLens with Unity 5 – Part #2: Creating a simple Hello World project

Last time I looked at setting up my development environment to allow me to develop for the Microsoft HoloLens Emulator. This time, I’m going to create a project in Unity, add in a simple primitive object, and use some C# to do something interesting with this object.

Creating a new Unity 5 project

If you’ve installed Unity correctly, you’ll be shown a screen like the one below after you open Unity 5 HTP for the first time.

screenshot.1468527247

Click on the “New project” button, and the screen should change to one similar to the one below. I’ve chosen the name “HelloWorld” for my project, and I’ve saved it to my desktop.

screenshot.1468527270

After entering the name and location of the new Unity project, I clicked the “Create project” button and Unity shows the screen below. This is an (almost) empty project, which only has the project’s main camera and the default directional light.

screenshot.1468527293

The next step is to update the scene with some settings which make sense for a HoloLens app.

Updating the scene for the HoloLens

The default camera is set about 10m behind the origin point of the scene. We’re going to make a few changes to this camera using the Inspector tab on the right hand side.

  • First, I changed the position of the camera to (0,  0, 0), meaning X = 0, Y = 0, and Z = 0;
  • Next, in the Camera section, I changed the Clear Flags dropdown value to Solid Color.
  • Finally, I change the Background property to Black (R = 0, G = 0, B = 0, A = 0).

screenshot.1468527338

These ensure that the camera – i.e. the point through which we will view the world with the HoloLens – is at the origin point.

Also, we’ve removed the default Skybox (i.e. background image), and any pixels rendered as black in our scene will appear as transparent in the HoloLens.

Add a cube

Now that we have the scene configured for the HoloLens, it’s time to add a simple object to our scene.

First, we right click on our Hierarchy pane on the left and side, select “3d Object”, and then select “Cube” from the sub-menu that appears.

screenshot.1468527392

A simple cube should appear in the centre of the scene, like in the image below. If the image does not appear in the correct place, make sure that the cube object appears in the Hierarchy menu at the same level of indentation as the Main Camera and the Directional Light.

screenshot.1468527417

Create a material

I’d like my cube to be a little more interesting than just a grey block – I’d like it to have a red colour. In Unity, we can achieve this by creating a Material asset and adding this component to the grey cube.

To create a material, I right click on the Assets node in the Project panel in the bottom left of the screen. From the context menu that appears, I select “Create”, and from the next menu that appears I select “Material”.

screenshot.1468527457

A new item is created and appears in the Assets panel – the cursor and focus are on this item, and I entered the value “Red”. Also, a grey ball appears in the bottom right hand corner. In the Inspector panel, I clicked on the color picker beside the “Albedo” label. In the pop up that appears, I selected a red colour, which updates the colour of the ball in the bottom right hand corner, as shown below.

screenshot.1468527481

Now that I’ve created a material, I can assign this to the cube. First I selected the Cube object in the Hierarchy panel. Next, I dragged the material named “Red” onto the Inspector panel on the right hand side. This is a surface that I can drag and drop components to. As soon as I drag the Red material to the Inspector for the cube, the cube turns red.

screenshot.1468527501

Moving the cube

It’s not very useful to have this cube surrounding our point of view – it makes more sense to have this sitting out in front of our point of view.

The easiest way to move the cube is to use the draggable axis which point outwards from the visible faces of the block. I clicked on the blue arrow – corresponding to the Z-direction – and dragged it forward about 3.5 units.

screenshot.1468532252

Just to make this block a little more visually interesting, I’d like to rotate it about its axes. To do this, I click on the rotate button in the top left hand corner (it’s the third button in the group of five, and is selected in the image below). The red cube now has a set of circles surrounding it, rather than the three arrows. You can click on these circles, and drag them to rotate the cube, as shown below.

screenshot.1468530487.png

That’s about it for the first section. You can preview what you’re going to see through the HoloLens by clicking on the Play button in the top-centre of the screen, which will show something like the screen below. The rotated cube floats in a black world, directly in front of our point of view.

Finally I saved the scene by hitting Ctrl+S, and typed in HelloWorld – you can see this in the assets panel.

screenshot.1468527590

Create a C# script to make the object rotate

Let’s take the complexity up a notch. We can write C# scripts and apply them to objects in our virtual world.

It’s very straightforward to create a script – right click on the Assets note in the Projects panel, and create a C# script from the context menus, as shown below.

screenshot.1468527606

I created a script called RotatorScript. To edit this, I double click on it. This opens VS2015 for me, though on your install it might open MonoDevelop.

I entered the code below:

using UnityEngine;
 
public class RotationScript : MonoBehaviour {
 
	public float YAxisRotationSpeed;
 
	// Update is called once per frame
	void Update () {
            this.transform.Rotate(0, YAxisRotationSpeed * Time.deltaTime, 0Space.Self);
	}
}

The code above does one thing – each time the frame is updated by the rendering engine, the object that the script is applied to rotates a little around it’s own axes. Specifically in this case, I’ve specified the X-axis rotation and Z-axis rotation to be zero, and the rotation around the Y-axis will be YAxisRotationSpeed degrees per second.

The code above refers to Time.deltaTime – this is a built in Unity function to tell us how long it has been since the last frame. Therefore if we multiply the speed – YAxisRotationSpeed – by the amount of time that passed – Time.deltaTime – the result is the number of degrees to rotate our cube by.

Once I saved the script in Visual Studio, I switched back to Unity. I selected my Cube in the Hierarchy panel, and then dragged the RotationScript to the Inspector for the Cube. In the property page which appears in the Inspector, I changed the value of the “Y Axis Rotation Speed” to be 50.

screenshot.1468527833

Now when I click on the Play button in Unity, I’m able to see the Game view of the scene again, but this time the cube is rotating about its own Y-axis.

screenshot.1468527888

Hello World!

It occurred to me that with the simple skills learned in this post that I could do something quite interesting with Unity – instead of a rotating cube, I could add a sphere to the scene, apply a material which was an image of Earth, and show a rotating globe, which would be a much more appropriate “Hello, World” project. I could even add a second sphere to rotate around this one, which could represent the Moon.

I’m sure I’m not the first person to do this in Unity in a blog post – I’m sure there are many like it, but this one is mine.

  • As a first step, I clicked on the Cube object in my hierarchy and deleted it. This removed the red cube from my scene.
  • Next, I right-clicked on the Hierarchy panel, and selected “Create Empty”. This created an empty GameObject to the hierarchy.
  • Using the Transform panel in the Inspector for the GameObject, I changed the Z-position to be 4, thus placing the GameObject 4m in front of my point of view.

screenshot.1468535169

  • Next, I right clicked on the GameObject in the Hierarchy and added a sphere 3d Object. I renamed this “Earth”, and changed the X, Y, and Z scale values to be 2 (i.e. doubling its size). Notice how this is indented under GameObject, and also how its position in the Transform box in the Inspector is at (0, 0, 0). This means that its centre is at the origin of the parent GameObject, and changes to the position will move it relative to the parent GameObject.

screenshot.1468535345

  • Following this, I right clicked on the GameObject in the Hierarchy again, and added another 3d sphere – I named this object “Moon”, and changed the X, Y, and Z scale values to be 0.5 (i.e. halving its size). I also changed the X-position value to be 2, thus moving its centre 2m to the right of the centre of the “Earth” object.

screenshot.1468535584

  • Finally for this part, I selected the parent GameObject in the Hierarchy view, and dragged the “RotationScript” to the Inspector surface. In the property page which appears on the Inspector, I change the “Y Axis Rotation Speed” to be 50.

When I hit the Play button, I can see the animation rendered, and show a scene from this below.

screenshot.1468535828

I can see that both objects are rotating correctly – the larger central sphere is rotating about its own central vertical axis, and the smaller sphere is orbiting that same axis. However, it doesn’t look very good with the default white colour. I can improve this by using some free assets from the Unity Asset Store.

Downloading assets from the Unity Asset Store

I searched the Unity Asset store through a browser – at http://www.assetstore.unity3d.com – for free renderings of Earth, and found the resource shown below (and linked to here).

screenshot.1468536101.png

I clicked on the “Open in Unity” button, and this switched my in-focus application to Unity. The Asset Store tab was open, and I was able to click on the “Download” button to acquire this resource (I did see a compatibility warning about how this was created with Unity 4). After a couple of pop-ups, I was shown the window below and chose to import one of the Earth material files, shown below.

screenshot.1468537055

After clicking on the “Import” button, this jpeg file appeared in my list of Assets, using its original directory structure.

I was able to select this from the Assets/EarthSimplePlanets/Textures folder in the Project panel, and drag the “EarthSimple1.jpg” file to the Inspector surface for the Earth sphere, and, the surface of this sphere updates to look much more like more characteristic world.

Finally, I selected the GameObject from the Hierarchy, and tilted the Z-axis by -15 degrees, to give a slight planetary tilt. After hitting the Play button, the animation shows a white sphere rotating around a planet.

We could enhance this further by downloading more assets from the store for the Moon – a good candidate is the moon landscape linked to here – but for right now, I think this will look pretty good in our HoloLens mixed reality world.

screenshot.1468573301

Wrapping up

That’s it for this post – so far, we’ve:

  • created a new project with Unity,
  • added some primitive objects to this world,
  • changed these object’s colour with materials,
  • added a C# script to make this object move,
  • arranged objects to make them orbit an axis outside the object, and
  • used the Unity Asset Store to download assets that make our model more realistic.

Next time, we’ll talk about actually deploying to the HoloLens emulator – there are a few tips and gotchas that I want to share to make other people’s journey a little smoother than mine.

.net, HoloLens, Unity, UWP, Visual Studio

Coding for the HoloLens with Unity 5 – Part #1: Setting up your environment

I’m starting a new series of posts on coding for the HoloLens with Unity. There’s relatively few posts on how to code for this device, and the ones that I’ve found so far haven’t been as complete as I’d like them to be, and this series will be part tutorial and part lab-notes for myself.

So far, I’ve planned for the first 3 posts in the series.

  • Part 1 – Getting started – downloading and installing the software;
  • Part 2 – Creating a project in Unity 5, and adding a simple object to a virtual world;
  • Part 3 – Deploying this project to the HoloLens emulator.

I’ll follow these introductory posts with some more complex and interesting projects.

Getting started – downloading and installing the software

You don’t need a physical HoloLens to develop software for the HoloLens (although it would help). You can develop your app using available tools, and test it on an emulator – as long as you have Windows 10 Professional. The reason for this is that the emulator uses Hyper-V, which is available on Window 10 Pro – it’s not available on the home edition.

Hardware requirements

There are detailed hardware requirements at this link – key requirements are a 64-bit CPU with 4 cores, 8GB of RAM, and hardware assisted virtualisation enabled in the BIOS settings – Microsoft provides a guide on how to do this here.

Software downloads

You’ll need to install 4 software components – VS2015.3, the HoloLens emulator, Unity 5, and the UWP runtime for Unity.

The first development tool you’ll need is the IDE – Visual Studio 2015, Update 3. This is freely available as the Community Edition. You can get this here.

Next, you’ll need the HoloLens emulator to test your apps – you can get the emulator here (v10.0.14342.1018). This is a simple executable, which will check to see if your computer is suitable for HoloLens development while it’s installing.

You’ll need two pieces of Unity software to develop and deploy using Unity 5. These are both available from the Unity site at this link.

  • The first item to download and install will be the Unity Editor for the HoloLens Technical Preview. There’s a special edition for the HoloLens, and you can choose to go with either a 32-bit version or a 64-bit version.
  • The second item is the UWP Runtime for Unity – this allows you to build your applications as a Universal Windows Platform application, which is necessary to deploy and run on a HoloLens.

You’ll need to register as a Unity developer, but there’s no charge for this if you’re using the personal edition option.

Next time I’m going to look at writing my first Unity 3d application, where I’ll create a simple object in a virtual world.