Unity - How can I disable the video background

March 31, 2015 - 1:10am #1

In Vuforia 4.0 and above, the camera video background is rendered on a textured plane, called "BackgroundPlane".

The BackgroundPlane is located under the Camera object attached under the ARCamera prefab of the Vuforia Unity Extension; you can visualize this in the scene hierarchy view in Unity, by expanding the ARCamera object hierarchy:

  • ARCamera
    • Camera
      • BackgroundPlane

The BackgroundPlane object contains a component called "Background Plane Behaviour"; you can switch off the camera video background rendering by simply disabling such component; for example, you may create a script like the following, and attach it to the BackgroundPlane game object:

using UnityEngine;
using System.Collections;
using Vuforia;

public class BackgroundOff : MonoBehaviour {

	private bool mBackgroundWasSwitchedOff = false;

	// Update is called once per frame
	void Update () {
		if (!mBackgroundWasSwitchedOff) {
			BackgroundPlaneBehaviour bgPlane = GetComponent<BackgroundPlaneBehaviour> ();
			if (bgPlane.enabled) {
				// switch it off
				bgPlane.enabled = false;
			}
			mBackgroundWasSwitchedOff = true;
		}
	}
}

 

Or, you can also disable the Background Plane Behaviour component through the inspector panel of the BackgroundPlane object.

 

 

Topic locked