# 2. AR Session and XR Origin
Part of [[AR Foundation]]. Prev: [[1. Packages and a Mobile AR Track]]. Next: [[3. Plane Detection and Raycasts]].
Official 6.5.1 [Scene setup](https://docs.unity3d.com/Packages/
[email protected]/manual/project-setup/scene-setup.html): every AR scene needs two GameObjects. If either is missing, **AR will not function properly**.
## 2.1 Create them from the official menu
Hierarchy, right-click:
- **XR > AR Session**
- **XR > XR Origin (Mobile AR)**
Official default hierarchy: a GameObject named "AR Session", a GameObject named "XR Origin" with a child "Camera Offset" and a grandchild "Main Camera". You may rename or reparent, but you still need both roles.
**AR Session** enables AR on the target platform. **XR Origin** enables device tracking and transforms trackables into Unity's coordinate system.
## 2.2 AR Session component (official)
Official [AR Session](https://docs.unity3d.com/Packages/
[email protected]/manual/features/session/arsession.html) (6.5.1): the component controls the lifecycle of the AR experience. On **non-OpenXR** platforms (this lab), enabling or disabling `ARSession` starts or stops the session. While disabled, the system no longer tracks environment features; enabling it later, official: the system attempts to recover and maintain previously detected features.
Official Inspector settings (supported platforms):
- **Attempt Update** - if enabled, the session tries to update a supported device if its AR software is out of date.
- **Match Frame Rate** - if enabled, the Unity frame is synchronized with the AR session. Official side effects: blocks each render frame until the next AR frame is ready, sets the target frame rate to the session's preferred update rate, and **disables VSync**. Official note: those settings are **not reverted** when you disable `ARSession`.
Official important: do not enable more than one of the same manager in a scene at a time (including more than one session).
## 2.3 One camera
The Origin already has a Main Camera. A leftover Game-view camera tagged Main will fight it. Delete or untag the old one.
## 2.4 Exercise
Create a fresh scene, add only the official Session + Origin, enter Play Mode on the Editor (it will not be a full AR session on a desktop), and confirm the hierarchy matches the official default closely enough that you could find the camera. The real test is a device build in part 5.
## Sources
- https://docs.unity3d.com/Packages/
[email protected]/manual/project-setup/scene-setup.html
- https://docs.unity3d.com/Packages/
[email protected]/manual/features/session/arsession.html