// Update is called once per frame void Update() { PopUp popUp = popUpCanvas.GetComponent <PopUp>(); if (popUp.confirmClicked) { popUp.confirmClicked = false; if (selectingPlant != -1 && popUp.selectBoxIndex != -1) { //swapping selected plant into the labspace print("about to swap"); PlantManager pManager = GetComponent <PlantManager>(); pManager.SwapPlant(selectingPlant, popUp.selectBoxIndex); selectingPlant = -1; } } else if (!popUpCanvas.activeSelf) { selectingPlant = -1; } }