//Function to delete a marking public void ListDelete() { dropdown = dropdownList.GetComponent <TMP_Dropdown>(); //Find dropdown component selectMarking = dropdownListValue.GetComponent <TextMeshProUGUI>().text; //Get marking selection from dropdown list //Remove selected marking from json file for (int i = 0; i < projectArray.Length; i++) { if (projectArray[i].ToString() != selectMarking.ToString()) { listString = listString + (projectArray[i].ToString()) + '"'; } else { i = i + 9; } } saveString = listString.Substring(0, listString.Length - 2) + "}"; File.WriteAllText(path, saveString); //Send listBool to InspectionButtons script bool listBool = false; InspectionButtons inspectionButtons = GameObject.Find("InspectionManager").GetComponent <InspectionButtons>(); inspectionButtons.GetListBool(listBool); //The Inspection Mode is closed after deletion, so destroy the spawned 3D model within the ImageTarget gameobject GameObject modelParent = GameObject.Find("ImageTarget"); foreach (Transform i in modelParent.transform) { Destroy(i.gameObject); } }
//This script has to run the timer to get the right duration for the no path found error. //Also, variables are sent to other scripts. public void Update() { //Send model selection to other scripts modelName = modelLoad; HierarchyManager hierarchyManager = GameObject.Find("InspectionManager").GetComponent <HierarchyManager>(); InspectionButtons inspectionButtons = GameObject.Find("InspectionManager").GetComponent <InspectionButtons>(); CoordinatesInput coordinatesInput = GameObject.Find("ImageTarget/" + modelName + "(Clone)/default").GetComponent <CoordinatesInput>(); hierarchyManager.GetModelName(modelName); inspectionButtons.GetModelName(modelName); coordinatesInput.GetModelName(modelName); //Send model selection to scripts of number objects (responsible for creating the marking tag) numbersObjects = GameObject.FindGameObjectsWithTag("Number"); for (int i = 0; i < numbersObjects.Length - 1; i++) { NumberValue numberValue = numbersObjects[i].GetComponent <NumberValue>(); numberValue.GetModelName(modelName); } pathList = path; //Timer to let popup wait between active and inactive if (timer >= 0) { timer = timer - Time.deltaTime; } if (timer < 0) { timer = 3; noPathPopUp.SetActive(false); } }