We’ll show you how to develop your first Meta app. These instructions have been built with the latest Meta 2 SDK.

Create a New Project

Open the Unity Editor and create a new 3D project.

Import the SDK

Meta’s Unity SDK is distributed as a single Unity package included in the SDK installer. This package contains all Meta assets for application development, including scripts, prefabs, and example scenes.

There are two ways to prepare to import the package into your Unity project:

  • The first way is to navigate to the Unity directory within the SDK installation directory (by default, C:\Program Files\Meta\Meta SDK2 Beta\Unity) and double click on the file Meta.unitypackage. This will prompt you to import the package into the currently open Unity project.

  • The second way is to import the package from within Unity. From the File Menu, click Assets > Import Package > Custom Package. Select the file Meta.unitypackage from the Unity directory in the SDK installation directory (by default, C:\Program Files\Meta\Meta SDK2 Beta\Unity).

Once you’ve completed either of these steps, Unity will prompt you to import the package with a dialog similar to the image below. Leave all of the items selected and click Import to proceed.

Import Unity Package

Project Settings

After importing the Meta 2 Unity SDK package, you will be prompted with a custom Unity window. This window shows the project settings recommended for maximum compatibility with Meta’s Unity package, and when those settings differ from your current project settings, allows you to update your current project settings to match our recommendations.

Note: We strongly recommend accepting all recommended settings. To do so, click Apply All.

Project Settings Dialog

Note: For optimal audio output from the Meta 2’s four speakers, please see here for instructions both on how to configure Windows to properly render audio for the Meta 2. This is required to take advantage of the quadraphonic setting this settings dialog applies.

To view this window again, select Meta 2 > Meta Project Settings from Unity’s menu bar.

Create a Meta Scene

In order to begin using the assets included in the Meta Unity package, you’ll need to import one or more of the provided prefabs into your scene.

1. Create a new scene or load an existing scene.
You can create a new scene from File > New Scene. Alternatively, you can load a scene you’ve already created.

2. Delete or disable existing Camera objects.
If you created a new scene, delete the Main Camera GameObject. If you are building or modifying an application that will support both the Meta 2 and another platform, you could alternatively choose to disable existing Cameras in the scene rather than deleting them.

3. Import the MetaCameraRig prefab.
Locate the MetaCameraRig prefab within the Project tab, either by searching for it or by navigating to Assets > Meta SDK > Meta > Resources > Prefabs.

Once you’ve located the prefab, simply drag it into the Hierarchy tab to import it into your scene.

At this point, you can press play to see how the MetaCameraRig prefab initializes tracking. You can also modify settings on the MetaCameraRig to see how they work, e.g. enabling surface reconstruction.

Further information about the MetaCameraRig prefab can be found here.

Lock the Camera Position (Optional)

By default, the Meta camera position is reset to <0,0,0> whenever you run the scene. If you want to pre-position the camera at a location other than the origin, you must nest the MetaCameraRig under another GameObject as follows.

1. Create a new GameObject at the origin.
The easiest way to do this is to right click in the Hierarchy view and selecting Create Empty. Name it Camera Origin (you can select an alternative name if you prefer).

2. Make the MetaCameraRig a child of your new GameObject and set the MetaCameraRig’s translation to <0,0,0>.
Drag the MetaCameraRig onto the new Camera Origin GameObject within the Hierarchy view. Reset the MetaCameraRig’s transform or manually set the translation to <0,0,0>.

3. Set the desired initial position on the new GameObject.
Set the position values of the Camera Origin GameObject’s transform to the location you want it to start within your scene.

Note that the MetaCameraRig will continue to follow changes in the transform of the Camera Origin, so this technique can also be used to animate the MetaCameraRig’s movement through your scene.

Add Hand Interactions (Optional)

To experiment with hand interactions, you can create a scene with an interactive object using the following steps.

1. Add the MetaHands prefab to your scene.
Locate the MetaHands prefab within the Project tab, either by searching for it or by navigating to Assets > MetaSDK > Meta > Resources > Prefabs.

Once you’ve located the prefab, simply drag it into the Hierarchy tab to import it into your scene.

See here for further details on the Meta Hands system.

2. Add a cube to your scene.
The easiest way to do this is to right click on the Hierarchy view an select 3D Object > Cube. Be sure not to delete the BoxCollider component from the new cube, as you’ll need that later.

3. Add the Grab Interaction script component to the new cube.
Select the Cube within the Hierarchy view, then click Add Component on the Inspector view and type GrabInteraction. Select this script to add it to your cube. You will now see a component attached to your object that looks like the image below.

Grab Interaction

4. Test Grab Interactions.
By default, the cube will now respond to grab interactions. When you grab the object, it will move with your hand’s position, and when you drop it, it will stay in place (assuming you didn’t add a rigidBody and enable gravity!).

You can also subscribe to the events within the GrabInteraction component in order to customize the interaction behavior.

Run the Scene

You’re ready to run the application. Simply click the play button to launch the application and then don the Meta 2.

Note that when you first put on the headset, you’ll see the SLAM initialization sequence, which will prevent you from viewing your application until it has completed. Provided that your working environment does not change much between launches of the application, the SLAM system will recognize your environment and the initialization sequence will be very brief.

Create a Standalone Build (Optional)

Note: In order to produce a functional build, we strongly recommend applying all recommended Unity project settings as described above.

1. Open the Build Settings Window.
This can be found under File > Build Settings. It looks like the following image:

Build Scene

2. Add your scene(s) to the Scenes in Build list.
Open the relevant scene(s) and click Add Open Scenes.

3. Click Build. Once the build is complete, double-click on the newly created executable to run your application.

Note: At this time, having the Meta 2 SDK installed is a prerequisite to running a build of a Unity application which uses the Meta 2 SDK.

Warning: The Meta SDK currently only supports one application working with the Meta 2 headset at a time.