Unity Sample Framework

The Unity Sample Framework provides sample scenes for developers for common VR-specific features such as hand presence with Oculus Touch, locomotion, custom hands, and the Oculus Guardian System. With the Sample Framework, developers can examine the sample scenes, see how features were implemented, and potentially use the content themselves.

Content in the Sample Framework has been designed so that developers can easily use it in their own existing projects. To encourage developers to use the content in the Sample Framework, it uses a very permissive license. For more information, see license.txt in Assets\Oculus\SampleFramework.

Download the Oculus Integration to access the Sample Framework, or search for Oculus Unity Integration in the Asset Store tab of the Unity Editor.

Importing the Sample Framework

The Sample Framework is a part of the Oculus Integration for Unity and can be found by searching for the Oculus Integration in the Asset Store tab of the Unity Editor. The Oculus Integration for Unity includes scripts, prefabs, and other resources to supplement Unity’s built-in support for VR development. The concepts, Game Objects, prefabs, and scripts used in the Sample Framework can be used in conjunction with the Oculus Integration for development of your own applications.

To import the Oculus Integration in Unity Editor:

  1. Verify that you have installed a recommended version of Unity (see Compatibility and Requirements for up-to-date information).
  2. Launch the Unity Editor and create a new project.
  3. Select the Asset Store tab and search for Oculus Integration. Import the integration into your project.
  4. You may be prompted to update OVRPlugin. It is recommended that you use the latest version. If there is an update and you install it, the Unity Editor will restart.

Exploring the Sample Scenes

Sample Framework scenes have been designed so that each one illustrates a basic concept important to Oculus and VR development. To keep things as simple as possible, the sample scenes require no configuration beforehand, and can be played right after importing the framework and opening them.

Here are the steps for running Sample Framework scenes:

  1. In the Unity Project window, navigate to Oculus > SampleFramework > Usage.
  2. Open one of the Unity scenes in the folder.
  3. Press the Play button

The sample scene should begin playing. For details on the scenes, look at the descriptions in the following table and explore the scene topics where available. After you’ve run a sample scene, feel free to experiment with the objects, components, and scripts that make up the scene.

Content and Sample Scenes

The Sample Framework features reusable components that developers can use in their own existing projects and sample scenes that demonstrate the usage of these components.

Content used in the scenes can be found in the \Usage\ and \Core\ folders under \Assets\Oculus\SampleFramework\. The content is divided between them as follows:

  • The \Core\ folder contains subfolders for each scene with content key to the scene’s core functionality. This content has been designed so developers can easily use them directly in their own existing projects.

  • The \Usage\ folder contains content that developers are not likely to want to use. This content generally has nothing directly to do with the interesting or prominent parts of the sample. They just demonstrate how to use the sample code in a working scene.

After the Oculus Integration has been imported, the sample scenes can be found in \Assets\Oculus\SampleFramework\Usage. The samples are listed in the following table.

Scene Concept Illustrated
AvatarGrabDemonstrates the use of Avatar hands to grab and manipulate predefined objects.
LocomotionProvides a framework for moving an Avatar through an environment with support for linear movement, teleports and related input, and visual effects.
OVROverlayDemonstrates how creating a UI with a OVROverlay compositor layer improves image quality and text clarity in comparison to an application layer UI.
CustomHandsDemonstrates the use of custom hand models. Developers can use this as a starting point for their own hands by building on the existing models and animations.
DistanceGrabDemonstrates the use of custom hands to grab and manipulate objects at a distance by having them zoom toward your hand.
GuardianBoundarySystem Illustrates use of OVRBoundary API to interact with the Guardian System outer boundary and play area.
CustomControllersDemonstrates custom controller models and interactive animations. While discouraged for use in gameplay, developers may want to use controllers in some specific cases, such as tutorials or demos.
DebugUIAn isolated example of the debug UI used in other sample scenes. By adding the CanvasWithDebug prefab to your project, developers can easily create UIs like the one in this scene.
MixedRealityCapture A scene with mixed reality capture enabled.
StartSceneUsed when building to create a menu from which to select one of these sample scenes.
Stereo180VideoDemonstrates video playback for Oculus Go and Gear VR.