Camera components
AR Foundation uses two primary components to control device camera functionality in your AR scene: ARCameraManager and ARCameraBackground. Your scene should contain at most one of each of these components enabled at a time. After initial scene setup you can find AR Camera Manager and AR Camera Background components in the XR Origin GameObject hierarchy at XR Origin > Camera Offset > Main Camera.
Platform support
AR Foundation cameras are supported on iOS and Android as indicated by the table below. On platforms that don't support the camera feature, the AR Camera Manager and AR Camera Background components will simply disable themselves in their OnEnable implementation.
Provider plug-in | Camera supported | Provider documentation |
---|---|---|
Google ARCore XR Plug-in | Yes | Camera (ARCore) |
Apple ARKit XR Plug-in | Yes | Camera (ARKit) |
OpenXR Plug-in | No |
AR Camera Manager component
The ARCameraManager component is a manager that enables or disables the device camera when the component is enabled or disabled, respectively, and gives you a scripting interface for camera-related features.
AR Camera Manager component
Property | Description |
---|---|
Auto Focus | Enables or disables a request to use the camera's automatic focus mode. When disabled, fixed focus mode is used. Availability of Auto Focus depends on camera hardware. |
Light Estimation | Estimates lighting properties of the environment. There are five options:
|
Facing Direction | Controls which camera is used. This value can be either World or User. On handheld mobile devices like phones and tablets, World refers to the rear camera and User refers to the front-facing ("selfie") camera. |
Render Mode | Sets the ARCameraManager 's requestedBackgroundRenderingMode, which specifies the stage in Unity's render pipeline that the AR camera background is rendered. There are three options:
|
Note
After Opaques has slightly different rendering behavior beyond its render order. After Opaques also causes ARCameraBackground
to render a fullscreen quad at the Camera's farClipPlane to ensure that depth testing properly culls fragments that are behind opaque geometry.
AR Camera Background component
The ARCameraBackground component renders video from the device camera as the background of the scene. Enable this component to render the AR background, and disable it to disable background rendering.
AR Camera Background component
Property | Description |
---|---|
Use Custom Material | If you set Use Custom Material to true, ARCameraBackground uses the Custom Material you specify to render the background. |
Custom Material | Only visible if Use Custom Material is true. Set this property to use your own shader to render the background. AR Foundation uses the Material from the active provider plug-in by default, but you can override the default with your own Material. |
* Apple and ARKit are trademarks of Apple Inc., registered in the U.S. and other countries and regions.