Convert Figma logo to code with AI

googlevr logogvr-unity-sdk

Google VR SDK for Unity

2,707
1,092
2,707
60

Top Related Projects

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity

Quick Overview

The googlevr/gvr-unity-sdk repository is the official Google VR SDK for Unity. It provides developers with tools and resources to create virtual reality experiences for Google Cardboard and Daydream platforms using the Unity game engine. This SDK enables easy integration of VR features into Unity projects, supporting a wide range of devices.

Pros

  • Easy integration with Unity projects
  • Supports both Google Cardboard and Daydream platforms
  • Provides a comprehensive set of VR features and tools
  • Regular updates and maintenance from Google

Cons

  • Limited to Google VR platforms (Cardboard and Daydream)
  • May require additional setup for certain Unity versions
  • Some features may be deprecated as VR technology evolves
  • Learning curve for developers new to VR development

Code Examples

  1. Initializing the GVR SDK:
using GoogleVR;

void Start()
{
    GvrViewer.Create();
}
  1. Implementing head tracking:
using UnityEngine;
using GoogleVR;

public class HeadTracking : MonoBehaviour
{
    void Update()
    {
        transform.rotation = GvrViewer.Instance.HeadPose.Orientation;
    }
}
  1. Handling controller input:
using UnityEngine;
using GoogleVR.Input;

public class ControllerInput : MonoBehaviour
{
    void Update()
    {
        if (GvrControllerInput.ClickButtonDown)
        {
            // Handle click event
        }
    }
}

Getting Started

  1. Import the GVR SDK package into your Unity project.
  2. Add the GvrEditorEmulator prefab to your scene.
  3. Set up your camera:
    using UnityEngine;
    using GoogleVR;
    
    public class CameraSetup : MonoBehaviour
    {
        void Start()
        {
            Camera.main.clearFlags = CameraClearFlags.SolidColor;
            Camera.main.backgroundColor = Color.black;
            Camera.main.nearClipPlane = 0.1f;
        }
    }
    
  4. Build and run your project on a supported device or emulator.

For detailed documentation and advanced features, refer to the official Google VR SDK documentation.

Competitor Comparisons

SteamVR Unity Plugin - Documentation at: https://valvesoftware.github.io/steamvr_unity_plugin/

Pros of steamvr_unity_plugin

  • Supports a wider range of VR hardware, including high-end PC-based systems
  • Offers more advanced features like room-scale tracking and motion controllers
  • Provides access to the SteamVR ecosystem and its extensive library of VR content

Cons of steamvr_unity_plugin

  • More complex setup and configuration process compared to gvr-unity-sdk
  • Requires more powerful hardware to run effectively
  • Less suitable for mobile VR development

Code Comparison

gvr-unity-sdk:

void Update()
{
    if (GvrController.TouchDown)
    {
        // Handle touch input
    }
}

steamvr_unity_plugin:

void Update()
{
    if (SteamVR_Actions._default.GrabPinch.GetStateDown(SteamVR_Input_Sources.Any))
    {
        // Handle controller input
    }
}

The code snippets demonstrate the difference in input handling between the two SDKs. gvr-unity-sdk uses a simpler approach focused on mobile VR, while steamvr_unity_plugin offers more detailed control for various VR input sources.

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity

Pros of MixedRealityToolkit-Unity

  • More comprehensive feature set for mixed reality development
  • Active community and frequent updates
  • Supports a wider range of devices and platforms

Cons of MixedRealityToolkit-Unity

  • Steeper learning curve due to its extensive features
  • Potentially higher performance overhead

Code Comparison

MixedRealityToolkit-Unity:

using Microsoft.MixedReality.Toolkit;
using Microsoft.MixedReality.Toolkit.Input;

public class ExampleClass : MonoBehaviour, IMixedRealityPointerHandler
{
    public void OnPointerClicked(MixedRealityPointerEventData eventData)
    {
        // Handle pointer click
    }
}

gvr-unity-sdk:

using UnityEngine;
using UnityEngine.XR;

public class ExampleClass : MonoBehaviour
{
    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            // Handle input
        }
    }
}

The code comparison shows that MixedRealityToolkit-Unity uses a more specialized input system with dedicated event handlers, while gvr-unity-sdk relies on Unity's standard input system. This reflects the broader scope and more advanced features of MixedRealityToolkit-Unity, but also highlights its increased complexity compared to the simpler approach of gvr-unity-sdk.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

November 6, 2019 update

There's a new open source Cardboard SDK for iOS and Android NDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR code scanning.

October 15, 2019 update

The Daydream View VR headset is no longer available for purchase. However, you can continue to use this SDK to update and distribute your apps to the Google Play Store, and make them available to users in the Daydream app.

Google VR SDK for Unity

Use Unity to build virtual reality apps for Android and iOS.

Copyright (c) 2016 Google Inc. All rights reserved.

Downloads

The latest GoogleVRForUnity_*.unitypackage and release notes are available from the releases page.

You can also clone and use the googlevr/gvr-unity-sdk git repository directly in a Unity project.

Getting Started

The Google VR SDK for Unity requires Unity 2017.4 or newer.

If you are new to the Google VR SDK for Unity, see the following guides: