Getting Started with Augmented Reality and Meta

By Patrick Catanzariti

Meta have been in the news recently after a much anticipated TED talk last week showcasing their next augmented reality headset, the Meta 2. This was fantastic timing for my first article on developing for the Meta augmented reality headset in Unity! If you have one of the original Meta headsets and you’ve been putting off building AR apps — now is a good time to dust that headset off and do some development!

In this tutorial, we will look at creating an augmented reality butterfly experience. We will be starting from the basics and will finish with a simple butterfly we can grab and move around our scene.

What You’ll Need

In order to follow along with this tutorial, you will need the following:

  • A Meta 1 Developer Kit – These are sold out, so if you aren’t lucky enough to have one, you’ll need to find a friend who owns one or wait for the Meta 2!
  • Unity 5.2.1 (32 bit) or Unity 5.2.2 (64 bit) – Meta support for Unity 4 is ending soon, so it is best to get up to Unity 5 by this point! I’d recommend downloading via Meta’s links which we’ll cover below.
  • Windows 8.1 or Windows 10 – Sadly Mac OSX isn’t supported and Windows 7 support is being phased out.

Downloading Unity and the Meta SDK

The safest way to get the right versions of both Unity and the Meta SDK is to head to the Meta Dev Center. From here, you can download the latest Meta SDK:

Downloading the latest Meta SDK

Once that has downloaded (or do this simultaneously if you’ve got much faster Internet than I do!), scroll down to download either the 64 bit or 32 bit Unity depending on your operating system:

Downloading either the 64 bit or 32 bit Unity

Once Unity has downloaded, run through the install process for both the Meta SDK and Unity. Both are pretty straightforward, so I won’t waste time discussing them here! Once both have installed, open up Unity and we will get started!

Creating Our First Project

When we first open up Unity, the welcome screen has an option for starting a new project in the top right. Click “New” to start a new project:

Creating a new project by clicking New

Then, we name our project (you can call yours whatever you’d prefer, we’ve gone with “Pretty Butterfly”) and choose where you’d like it saved on your computer. Make sure you have 3D chosen on the bottom left! When ready, click “Create Project”:

Setting up our Unity project settings

Before doing anything else, it can be a good idea to have your initial scene named and saved. To do so, go to File > Save Scene as….

Saving our initial scene, File > Save Scene As

We add a new folder for our scenes within the project’s “Assets” folder called “Scenes”:

Creating a new folder for our scene

Then name our scene “ButterflyScene” — you can name yours whatever you’d like!

Naming our scene

Importing the Meta SDK

Now that we have a scene saved and ready, it is time to import in the Meta SDK we downloaded earlier. To do this, we click Assets > Import Package > Custom Package…:

Importing a custom package via Assets, Import package, Custom Package

Navigate through your filesystem to the Meta SDK. For me, this was in C:/Program Files (x86)/Meta/Meta SDK. In this folder, we choose the “Meta” Unity package:

Selecting the Meta unity package

After a bit of loading time, a window with all of the Meta SDK assets found will appear. Ensure everything is checked and click “Import”:

Importing Meta package ensuring everything is checked

If Unity pops up saying “This project contains scripts and/or assemblies that use obsolete APIs”, that’s okay. Just click “I Made a Backup. Go Ahead!”

Yes, I made a backup

We should now see two new folders, “Meta” and “MetaPackage”, within our project:

Meta assets now visible

Adding MetaWorld Into Our Project

Within our new assets, we have our “MetaWorld” Prefab that will give us all of the Meta camera and interaction functionality we need. If you are new to Unity — Prefabs are basically like template objects that can be reused in multiple projects and scenes to share functionality.

The easiest way to add this into our scene is to search within the “Project” window. Type in “MetaWorld” and it should filter our assets to show us what we want. Drag the “MetaWorld” prefab into your project hierarchy (where you’ve currently got a “Main Camera” and “Directional Light”):

Dragging in MetaWorld Prefab

The actual location of the “MetaWorld” prefab for those wondering is Meta/MetaCore/Resources/Prefabs/MetaWorld.prefab.

The “MetaWorld” object is our augmented reality view of the scene and represents our Meta headset. Make sure it is positioned at {0, 0, 0} and has no rotation on it. This is our camera view, so we can delete the existing “Main Camera”. We can also delete the “Directional Light”:

MetaWorld positioning in our scene

Adding Our Butterfly

The cleanest way to organise our scene is to create a new empty game object which will include the rest of our elements. For those new to Unity, this creates a nice and simple container for our objects. To do so, go to GameObject > Create Empty.

Creating an empty game object

We rename this object to “Butterfly App” and ensure that it is positioned at {0, 0, 0} with no rotation. This is important as all objects placed within this will use the parent object’s position as a base.

Rename it to Butterfly App

To get a pretty butterfly model to use, we will visit the Unity Asset Store. If you’re not a fan of butterflies (unlikely, but you never know!), you could download almost any model for this to work. Experiment away!

We will click on the “Asset Store” tab, next to our “Scene” and “Game” tabs, then type in “butterfly” in the search box:

Searching for a butterfly

If we scroll a little bit, we will find a nice free one that will work perfectly for our demo:

The free butterfly download

Click “Download” to begin downloading the files for our butterfly:

Butterfly download

In the import window that appears, ensure everything is checked (just as we did when importing in the Meta SDK) and click “Import”:

Importing butterfly

If we go back to the root of our “Assets” folder, we can now see a new folder with our new butterfly assets!

Our new butterfly assets

Within this new folder, we navigate to Assets > GruffysAnimatedButterfly > Prefab. We now drag the “butterfly2” prefab into our “Butterfly App” empty game object.

Putting butterfly into scene

You can play around with the positioning of the butterfly if you’d like. The best position I found was to have position Z moved away from the camera by 0.4, but X and Y remain at 0. I’ve rotated the butterfly on the Y axis by 150 and scaled it on all axes by 0.05. The scale can definitely be whatever you’d like, if you’d like a bigger butterfly, feel free to enlarge it (but you may need to move it back a bit more on the Z axis to see it properly if you go too big!).

Butterfly positioning

If you haven’t already, remove the “Directional Light” that came with the Unity scene — we won’t need it.

Giving Our Butterfly Meta Capabilities

In order to be able to pick up and move our butterfly around the scene, we need the butterfly itself to be a “MetaBody”. This is a component which comes with the Meta SDK and is simple to add to any object in Unity.

To turn any Unity object into a MetaBody-enabled object, click on the object (e.g. our “butterfly2” in this case), click “Add Component” on the right hand side and search for “metabody”. Click “MetaBody” when it appears:

Adding MetaBody

In the settings which appear now for our object, tick the following:

  • Grabbable and Move – This is what allows us to pick up and move our butterfly around the scene.
  • Arrow – This provides a directional arrow on the Meta interface pointing at where the object is when it is not on screen. This is really useful for objects which the user can move around the scene – as people tend to drop objects and not see where they’ve gone! The arrow saves a lot of time and confusion!

If we run the app now, we’d struggle to see the butterfly and might be a tad confused (I know I was initially). This isn’t because we have done anything wrong in the Meta SDK or in Unity. If you have been following along step by step, you’ll be in the same situation — it is due to a shader that is on our butterfly by default to make its wings blend in nicely with the scene.

To make it visible for our Meta headset, we will want to change this shader. To do so, click to expand the “butterfly2” game object in the project hierarchy and select “Butterfly Mesh”. With this selected, click the shader dropdown on the right:

Butterfly shader dropdown

In the menu that appears, go to Mobile > Particles and choose “Additive”. This gives us a different shader that makes our butterfly object shine through our scene! Much nicer, it actually gives it almost a hologram-style feel to it in augmented reality too.

Changing the butterfly shader

In Action

With that, we save our scene and are now ready to test it out! Connect up your Meta headset and press the play button on the scene.

Click play

There are a few things that you might need to do if you aren’t seeing a butterfly as you’d hoped:

  • Not seeing your butterfly in front of you? You might need to recentre your view by clicking F4 — or follow the arrow!
  • Not seeing two images side by side in your headset? Make sure you’ve clicked the 3D button on the bottom left of your Meta developer kit control box.
  • Not seeing two images side by side in Unity’s preview? Press F2 to switch to side-by-side mode.
  • Seeing a very small image in your headset? Press F3 to switch to the rectified view.

If you have got it displaying successfully, you should be able to see a butterfly floating in your scene! You can grab it and move it around with your own hand. Grabbing objects which don’t really exist in reality is something which can take a bit of getting used to:

  • Make sure you have your open hand in front of the glasses until you see a dotted yellow circle.
  • Close your hand into a fist and that circle will go green.
  • Move your fist around to move the butterfly around the scene.
  • Open your fist again to let it free!

Here’s what my butterfly looks like in side by side view (this view looks 3D when viewed through the headset):

In action with double vision

Here is a view of it with just one screen to show what someone wearing the headset will see:

In action with single view


Augmented reality is a really fascinating area that is ripe for so many opportunities! If you don’t have a Meta headset and are keen to get involved, more details on the Meta 2 headset should appear on 2nd March, at 9am PST on the Meta Website. This is my favourite choice right now for AR headset development! Here’s hoping there’ll be plenty of developer kits to go around when they announce more details. The new headsets look like they will have a greater field of view and higher resolution display than the Meta 1. I’m eagerly hoping to get my hands on a pair myself!

Are you a current Meta Pioneer developing on the platform? Or a pioneer who now has a renewed interest in getting their headset out and doing some development? Have you already got a prototype going? Has a new idea sparked in your mind after reading through this? I’d love to hear what you are up to! Let me know in the comments below, or get in touch with me on Twitter at @thatpatrickguy.

  • ryanpamplin

    This is a great tutorial. Thanks for posting!

    • Patrick Catanzariti

      Thank you for the kind words! :D Much appreciated!

  • DonGateley

    Thank you. I’m not a developer but you’ve given me a good idea of what goes into creating a rudimentary app.

    Is there a link to their Ted talk anywhere you know of? I’ve looked for it to no avail.

    • Patrick Catanzariti

      I think the TED talk is yet to be released to the public, it will be up at some point though. I’ll try to post up a link here when it goes up!

  • Brennan Hatton

    Awesome work mate! You broke this down really nicely

    • Patrick Catanzariti

      Thanks Brennan :)



Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in Front-end, once a week, for free.