# 4. Touch Input and Session State Part of [[AR Foundation]]. Prev: [[3. Plane Detection and Raycasts]]. Next: [[5. Worked Example Place on a Plane]]. ## 4.1 Screen points from the Input System `ARRaycastManager.Raycast` wants a **pixel** position. Use the [[Input System]] (and, on a phone, [[Mobile Input and Touch]]) to get a pointer position. Do not invent a new input stack, and do not poll `UnityEngine.Input.GetTouch` if this project is Input System-only. A pointer-down on a UI button should **not** also place an object. If you have EventSystem UI ([[4. UI Input and XR Input]] in the Input System series), ignore taps that the UI already consumed. Confirm the 1.20.x API you already use for "pointer over UI" rather than inventing one here. Device Simulator is not an AR runtime. A mouse-in-Editor test of your *screen-point math* is fine; a pass on **ARKit or ARCore hardware** is the real assignment. ## 4.2 Session state (official) Official: other AR features depend on the session and cannot function properly until the session is tracking. Read **`ARSession.state`** and/or subscribe to **`ARSession.stateChanged`**. Official also: `CheckAvailability` to check whether AR is available on the device. Do not invent the full enum list from memory. Open the 6.5.1 AR Session manual's session-state table and branch on the values it lists (the page includes states such as checking availability, installing, and session initializing). Show a "move the device" or "AR not available" label when the official table says you are not tracking yet. Do not place prefabs until a raycast can succeed. ## 4.3 Match Frame Rate reminder If you enabled Match Frame Rate (part 2), remember official side effects (VSync disabled, target frame rate changed) and that they are **not** automatically reverted. For a class placement lab, leaving it off is a reasonable first choice unless you have measured a need. ## 4.4 Exercise Log `ARSession.state` (and changes) on a device build. Confirm you can print a screen-space tap position from the Input System on that same build before you hook raycasts. ## Sources - https://docs.unity3d.com/Packages/[email protected]/manual/features/session/arsession.html - [[Input System]] / [[Mobile Input and Touch]]