How to Select an Object in the World — Unity AR

Paul Killman
Antaeus AR
Published in
3 min readFeb 27, 2024

In a previous article, I wrote about placing AR objects in the physical world. In this article, I will show how to select them.

I used a simple cube for the AR object that I placed. Because the origin point was in the center of the cube, it appeared to be halfway buried in the plane. To fix this, I created an empty object and then made the cube a child of it. I moved the childs Y position to be half of it’s scale so that it would appear to be resting on the plane.

Now that the cube appears properly, it’s time to make it selectable. I added an AR Selection Interactable to Placement Prefab, (the parent object).

We cannot fill in the Interaction Manager or XR Origin fields because the prefab doesn’t yet exist in the scene. When the prefab is placed in the scene, the AR Selection Interactable will find the correct objects to use.

You will notice an area for Colliders. Drag the child Red Cube to this area. AR Selection Interactable depends upon AR Raycasting to work, and AR Raycasting needs a collider. This will tell the raycast which collider to look for.

To make it visually obvious that the cube had been selected, I added a blue cylinder to the prefab and named it Selected. I made it a child of the Red Cube and set it too inactive.

I drug Selected to the Selection Visualization field in AR Selection Interactable. Now, when we select a Placement Prefab, a visual cue will appear to show its status.

I built the project and tried it out on my phone.

Placement Prefab Placed
Placement Prefab Selected

When I selected the Placement Prefab, the blue cylinder appeared to show that it had been selected.

--

--