The simplest way to spawn an object in AR would be to make it so when the player taps on the screen it will spawn an object where our Placement Indicator object is. But before we do that, we first need to make an object that we'd want to create within the scene.
Follow the steps given here:
- Create a sphere by going to GameObject | 3D Object | Sphere.
- From the Inspector window, set Position to (0,0,0) and set Scale to (0.2, 0.2, 0.2).
- Add a Rigidbody component to the sphere by going to Component | Physics | Rigidbody.
By adding the Rigidbody component, we are letting Unity know that we want this object to be affected by things such as gravity and react to collision events and forces being applied to it. At this point, you could customize the object as much as you'd like, change the mesh and collider, and so on.
- Go to the Project window, and open the Prefabs folder. Create a prefab of our sphere by dragging and dropping it from the Hierarchy window to...