As an Associate of Unity Asset Store, this website earns from qualifying purchases & contains affiliate links: check the footer for more info.

Camera Feed on Background — Unity Asset — Mobile Camera Stream — Device Camera

Camera Feed on Background — Unity Asset that uses Back/Rear or Front/Face Camera on the player’s mobile device to display the Live Video Input on the Background of the Scene. Safety First.

Unity Asset Store — Download Button

It doesn’t use any Motion Sensor of a Mobile Device (Gyroscope or Accelerometer) to rotate the Game World like in AR Camera Lite (docs) or in AR + VR: MR Camera (docs).

Features of Camera Feed

Bring the enchanting Power of Camera Feed into your amazing Game or App:

  • Cross-platform Camera Feed: iOS, Android.
  • Device Orientations: Portrait, Landscape.
  • Smartphone Cameras: Rear/Back, Front/Face/Selfie.
  • Button: Switch Camera (Back/Front).
  • Instant Launch after granting the camera permission.
  • Quick Testing in Unity Editor with Web Camera.

Package Contains

  • Demo Scene with Camera Feed.
  • Menu Scene with Safety Tutorial.
  • Permission Scene with Camera Permission Request using free Native Camera.
  • Loading Screen to switch scenes seamlessly.

Check the Map of Unity Assets to choose the product that best suits your needs.


Limitations

Asset doesn’t operate with Native Code and relies on WebCamTexture class.
Any possible Limitations are related to this class.

Known Issues

Use Cases

1. With adding rotation of the Game Camera with the Motion Sensor of a Mobile Device (Gyroscope or Accelerometer), Camera Feed on Background can be used as a “Pseudo AR Camera” to display 2D or 3D objects as though they were in the real world.

This technique was implemented in AR Camera Lite (docs).


2. With integration of Google Cardboard XR Plugin, the Camera Feed on Background can be used as a Mixed Reality (MR) Camera. This idea was implemented in AR + VR: Mixed Reality Camera (docs).


3. AR Shooter (docs).


Tutorial

This tutorial is relevant for Camera Feed on Background 2.0+.
Tutorial for the previous version can be found only in the asset folder.

Getting Started with Camera Feed on the Background

Folders & Files in the package by default:

  • Makaka Games.

Steps

If you have any issues with the first launch, then just Reach Support with Invoice Number and Get Help.

If you read this tutorial from PDF, first check the latest docs online to get actual information.

  1. Create New Unity Project with Unity 2022.3.18 & “3D” Template.
  2. File > Build Settings > iOS or Android > Switch Platform.
  3. Next Packages must be manually installed with Git & Unity Package Manager:
  4. Download and import Camera Feed on Background into Unity.
  5. Window > TextMeshPro > Import TMP Essential Resources.
  6. Reopen Unity Project.
  7. Open Scene: Makaka Games > Camera > Camera Feed On Background > Scenes > Demo.
  8. File > Build Settings > Add Scenes to build:
    • Menu,
    • Permission_Camera (from Makaka Games > Permissions > Camera > Scenes),
    • LoadScreen (from Makaka Games > Publisher > Everyday Tools > SceneControl > Scenes),
    • Demo.
  9. Option: Limit the Screen Orientation from Auto (by default) to the Portrait only or Landscape only by indication of appropriate Scene Loading Methods on the corresponding buttons that cause a transition to another scenes. Orientation in the Player Settings is used for the 1st scene in the build.
  10. Option: File > Build Settings > Development Build > Check (to See the Log in the Console).
  11. File > Build Settings > Player Settings > iOS > Other Settings > Camera Usage Description > Fill it (any notice for your app).
  12. Test in the Unity Editor or Build for Mobile.

Useful Article: How to Test iOS App without Developer Account?

Placing Visible Game Objects

If you need to place visible Non-UI Game Objects over the Device Camera Feed, then just Activate the Game Object called Game World, and place Game Objects inside it.

Game World contains a separate Camera for this task: Main Camera.

After activating, you will have 2 Game Cameras in the Scene:

  • Background Camera (UI Layer) for Device Camera Feed and UI.
  • Main Camera (other Layers) for visible Non-UI Game Objects.

Game Objects will not move based on Device Movement.
Use AR Camera Lite (docs) or AR + VR: MR Camera (docs) instead.


Feed FPS and App FPS

The Unity Package has a Prefab called CameraFeedOnBackground that is already customized for the best experience in the Demo Scene.

You can customize the Prefab Instance on the Scene with Target FPS of Camera Feed and App:
these 2 types of Frames Per Second (Frame Rate) are set independently of each other:

  • Camera Feed will use the closest supported FPS. Zero (0) FPS will lead to Value by Default.
  • The App will strive to use Target FPS.
Camera Feed on Background — Unity Editor of Unity Asset — Mobile Camera Stream — Device Camera

Testing

You can test Camera Feed quickly in Unity Editor without a Smartphone through physical Web Camera.

Tested with Devices

  • iOS on iPhone XS Max.
  • Android on Samsung Galaxy A71.

If you need WebGL support, please use a 3rd party asset called Device Camera WebGL.

Support

First, read the latest docs online.
If it didn’t help, get the support.

Changelog

Check the current version of Camera Feed on Asset Store.
The latest versions will be added as soon as possible.

2.0:

Features:

  • Button: Switch Camera (Back/Front).
    • Unity Event OnCameraSwitched() is exposed in Inspector.

Improvements:

1.3:

Features:

  • Front Camera Support.

1.2:

Improvements:

Fixes:

  • Zoom Effect of Camera Feed in Vertical/Portrait Mode.

1.1:

Features:

  • Horizontal/Landscape Mode support.
Unity Assets

Support for Unity Assets

I am Andrey Sirota, Founder of Makaka Games and full-time Publisher on the Unity Asset Store. First, read the latest docs online. If it didn’t help, get the support.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

Back to top button