Unity AR with Gyroscope or Vuforia 🏀⚽🎱

Assets and Templates with Augmented Reality

An online version of сomplete documentation for my Unity AR Assets with Augmented Reality.

AR Camera GYRO

Note: Cross-platform mobile camera implements markerless augmented reality (AR) by using a gyroscope (like Pokemon GO).

AR Camera GYRO uses the camera and gyroscope on the player’s mobile device to display 2D or 3D objects as though they were in the real world.

AR Camera GYRO is a part of AR Basketball GO and AR Throw Ball.

All modules are designed independently to keep this asset extendable & easy to understand.

Gyro vs. Accelerometer

90% of all mobile devices have an accelerometer and video camera but only 20% have a gyroscope.

If you want greater coverage of devices, but less accuracy and stability, use AR Camera ACCELEROMETER.
If you want greater accuracy and stability, use AR Camera GYRO.

You can also try to use both cameras for different cases.

Different devices have different gyroscopes, and therefore different deviations and drifts.

Tested With

— iOS on iPhone 6.
— Android on Samsung Galaxy S7, Lenovo A606.


Download on Unity Asset Store.


ARCameraGYRO prefab & GyroCameraControl.cs

ARCameraGYRO prefab has main camera control script: GyroCameraControl.cs.


Camera for virtual world rotating depending on the gyro data.


You can assign a function (in the inspector) to be executed if the gyroscope is not supported by your smartphone.


Interface into the Gyroscope. Use this variable to access gyroscope.


Is a gyroscope available on the device?


rotationFix = new Quaternion (0f, 0f, 1f, 0f);
It corrects a position of the camera every Update () call.

Known issues

Unity AR bugs: Gyroscope

  1. INPUT.GYRO.ATTITUDE returns zero values on Motorola Moto G4 and G5.
  2. INPUT.GYRO is extremely laggy on Samsung Galaxy S6, S6 Edge and S8 with Android 7.0.
  3. INPUT.GYRO.ATTITUDE returns acceleration’s values: Fixed in Unity 2017.2.
Your actions

Vote on these issues and comment them.
It’s important for Unity Team, so users should pay them attention to the situation.

Black screen on iOS

You just need to fill Camera Usage Description in Unity Editor.

Go to Unity Editor > Player Settings > iOS > Other Settings > Camera Usage Description > Fill it (any note for your app).

AR Shadow

AR Shadow implements simple real-time shadows for apps with Augmented Reality (Vuforia, Gyro, Accelerometer, any AR).

Package contains demo with Vuforia.

Tested With

— iOS on iPhone 6.
— Android on Lenovo A606.


Download on Unity Asset Store.

Getting started from scratch

  1. Go to Edit > Project Settings > Quality.
  2. Choose Default Quality Level for a target platform.
    1. Shadow Projection = Close Fit.
    2. Shadow Distance = 400.
  3. Create Plane (ARGround prefab).
    1. Place plane on the marker (a bit higher) if you use marker AR like Vuforia. If you use markerless AR (e.g. AR Camera GYRO) then place the plane on your origin so you can see the shadows.
    2. Resize plane for all your active area of game action.
    3. Attach ARShadow material with ARShadowSurface shader (AR/ARShadowSurface) to the Plane.
      1. Cutout = 1.
  4. Create Direction Light (ARDirectionalLight prefab).
    1. Intensity = 1.5 or 1.0.
    2. Shadow Type = Soft Shadows.
      1. Strength = 0.323.
      2. Bias = 0.13.
      3. Normal Bias = 0.
      4. Near Plane = 0.9.
    AR Shadow - Directional Light | Manual
    AR Shadow – Directional Light
  5. Press Play and see the AR shadows from objects.


Unity 2017.2 integrates the Vuforia Engine.
You can learn more about new pipeline on Vuforia Developer Portal.

Why does not Vuforia work?


  1. Vuforia Developer Portal Develop > License Manager > Get Development Key.
  2. Go to Window > Vuforia Configuration > App License Key > Paste your Key.
  3. File > Save Project.

Build & Run on mobile

If you have errors when you try to make a build for mobile platform:

  • Go to Unity Editor > Player Settings > Target Platform > XR Settings.
  • Check the “Vuforia Augmented Reality Supported”.

Known issues


First of all, read this documentation for Unity AR.
If it didn’t help, get the support.

3 Reasons Your Game needs to contain AR mode

Acceleration of everyday activities
Viewing objects from the inside
The materialization of abstract concepts that can be felt
User Rating: 5( 9 votes)

Andrew Sirota

Hi, friend! I am Founder at Makaka Games. I love Augmented Reality. I am open for communication and ready to implement your craziest ideas. Today we are Starting a new Experiment.

Related Articles

Leave a Reply