In the Update method, we need to check if the screen has been touched. If so, then we want to set our boolean value to true.
if (Input.touchCount > 0)
{
isTouched = true;
}
Then, we need to add an object to a screen and increment the index.
if(isTouched)
{
arInstance[index].gameObject.SetActive(true);
arInstance[index].transform.position = pose.position;
arInstance[index].transform.up = pose.up;
isTouched = false;
index++;
}
Don’t forget to change the else statement of the RayCast so that it reflects the object.
arInstance[index].gameObject.SetActive(false);