using UnityEngine; using System; using System.Collections; using System.Collections.Generic; using UnityEngine.XR.ARFoundation; [RequireComponent(typeof(ARRaycastManager))] public class Selection__1 : MonoBehaviour { public GameObject placePrefab; private ARRaycastManager aRRaycastManager; private static List hits = new List(); private void Awake() { aRRaycastManager = GetComponent(); } private void Update() { if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); if (touch.phase == TouchPhase.Began) { var touchPostion = touch.position; if (aRRaycastManager.Raycast(touchPostion, hits, UnityEngine.XR.ARSubsystems.TrackableType.Planes)){ var hitPose = hits[0].pose; Instantiate(placePrefab, hitPose.position, hitPose.rotation); } } } } }