Sorry if the code isn't neat. I'm able to place anchors the first time I "Activate the AR" inside the app, If i go back and open AR Once again I'm Unable to place Anchors Why is that ? Thank you in Advance Code (CSharp): using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.XR.ARFoundation; using UnityEngine.XR.ARSubsystems; public class Positioning : MonoBehaviour { [SerializeField] public GameObject root; public string childname; [SerializeField] GameObject xyz; private Transform child; Vector3[] positions = new Vector3[2]; [SerializeField] public Text debugLog; [SerializeField] public Button toggleButton; public Vector3 Cube1; public Vector3 Cube2; [SerializeField] public Text referencePointCount; private ARRaycastManager arRaycastManager; private ARAnchorManager arAnchorManager; private ARPlaneManager arPlaneManager; private List<ARAnchor> referencePoints = new List<ARAnchor>(); private static List<ARRaycastHit> hits = new List<ARRaycastHit>(); public int helper; public void removePoints() { referencePoints.Clear(); } private void Awake() { child = root.transform.GetChild(0); Debug.Log(child.name); arRaycastManager = GetComponent<ARRaycastManager>(); arAnchorManager = GetComponent<ARAnchorManager>(); arPlaneManager = GetComponent<ARPlaneManager>(); toggleButton.onClick.AddListener(TogglePlaneDetection); } private void OnEnable() { hits.Clear(); referencePoints.Clear(); referencePointCount.text = $"Reference Point Count: {referencePoints.Count}"; if (toggleButton.GetComponentInChildren<Text>().text == "Enable Plane Detection") { TogglePlaneDetection(); } } private void OnDisable() { removePoints(); referencePointCount.text = $"Reference Point Count: {referencePoints.Count}"; } private void OnDestroy() { removePoints(); referencePointCount.text = $"Reference Point Count: {referencePoints.Count}"; } [System.Obsolete] void Update() { if (Input.touchCount == 0) { return; } Touch touch = Input.GetTouch(0); if (touch.phase != TouchPhase.Began) { return; } if (arRaycastManager.Raycast(touch.position, hits, TrackableType.PlaneWithinPolygon)) { if(toggleButton.GetComponentInChildren<Text>().text == "Disable Plane Detection") { Pose hitPose = hits[0].pose; ARAnchor anchorPoint = arAnchorManager.AddAnchor(hitPose); if (anchorPoint == null) { referencePointCount.text = $"Reference Point Count: {referencePoints.Count}"; } else { referencePoints.Add(anchorPoint); referencePointCount.text = $"Reference Point Count: {referencePoints.Count}"; } positions[referencePoints.Count - 1] = anchorPoint.transform.position; if (referencePoints.Count == 2) { root.SetActive(true); child = root.transform.GetChild(0); Vector3 CubePosition = Cube1 - child.Find(childname).transform.position; //Vector3 BuildingPosition = positions[0] - CubePosition; Vector3 BuildingPosition = positions[0]- CubePosition; child.Find(childname).transform.position = BuildingPosition; xyz.SetActive(false); /* * A --> maxBounds // Cube 2 * / * / * / * B --> position[0] --> MinBounds // Cube 1 * \ * \ * \ * C --> Position [1] * * * Vector BA --> MaxBounds - MinBounds * Vector BC --> Position[1] - Position[0] * * BA_Mag = Sqrt(BA^2) * Vector BANorm = (BA / BA_Mag) * * BC_Mag = Sqrt(BC^2) * Vector BCNorm = (BC / BC_Mag) * * */ Vector3 BA = new Vector3(Cube2.x - Cube1.x, Cube1.y, Cube2.z - Cube1.z); Vector3 BC = new Vector3(positions[1].x - positions[0].x, Cube1.y, positions[1].z - positions[0].z); float BA_mag = Mathf.Sqrt(BA.x * BA.x + BA.y * BA.y + BA.z * BA.z); Vector3 BA_norm = new Vector3(BA.x / BA_mag, BA.y / BA_mag, BA.z / BA_mag); float BC_mag = Mathf.Sqrt(BC.x * BC.x + BC.y * BC.y + BC.z * BC.z); Vector3 BC_norm = new Vector3(BC.x / BC_mag, BC.y / BC_mag, BC.z / BC_mag); float res = BA_norm.x * BC_norm.x + BA_norm.y * BC_norm.y + BA_norm.z * BC_norm.z; float rotationAngle = Mathf.Acos(res) * 180 / Mathf.PI; Debug.Log("Vector BA " + BA); Debug.Log("BA_mag " + BA_mag); Debug.Log("BA_norm " + BA_norm); Debug.Log("*********************"); Debug.Log("Vector BC " + BC); Debug.Log("BC_mag " + BC_mag); Debug.Log("BC_norm " + BC_norm); Debug.Log("*********************"); Debug.Log("res " + res); Debug.Log("rotationAngle " + rotationAngle); float rotatingAngle = Vector3.Angle(BA, BC); Debug.Log("rotatingAngle " + rotatingAngle); TogglePlaneDetection(); changeBuildingPosition(BuildingPosition, child); if ((Cube1.x > Cube2.x) || (Cube2.z > Cube1.z)) { //StartCoroutine(Waiter(-rotatingAngle, positions[0])); changeRotation(-rotatingAngle, positions[0]); } else { //StartCoroutine(Waiter(rotatingAngle, positions[0])); changeRotation(rotatingAngle, positions[0]); } } } } } private void TogglePlaneDetection() { arPlaneManager.enabled = !arPlaneManager.enabled; foreach (ARPlane plane in arPlaneManager.trackables) { plane.gameObject.SetActive(arPlaneManager.enabled); } toggleButton.GetComponentInChildren<Text>().text = arPlaneManager.enabled ? "Disable Plane Detection" : "Enable Plane Detection"; } private void changeBuildingPosition(Vector3 ItemPosition, Transform child) { foreach (Transform children in child) { children.position = ItemPosition; } } private void changeRotation(float rotationAngle, Vector3 position) { //child.RotateAround(position, new Vector3(0, 1, 0), rotationAngle); foreach (Transform children in child) { children.RotateAround(position, new Vector3(0, 1, 0), rotationAngle); } } }