private void MoveUnitFromBase() { if (Input.GetMouseButton(1)) { if (Input.GetMouseButtonDown(1) && !armyGuide && onItem) { armyGuide = Instantiate(armyGuidePref, GetMousePos(), Quaternion.identity); armyGuide.name = "Army Guide"; startSending = true; } else if (armyGuide) { armyGuide.transform.position = GetMousePos(); Debug.Log("SelectedItem: " + selectedItem); } } if (Input.GetMouseButtonUp(1) && startSending) { if (curBaseScript && Vector2.Distance(GetMousePos(), selectedItem.transform.position) > 0.64f) { curBaseScript.SendArmy(GetMousePos()); curBaseScript = null; startSending = false; Debug.Log("Sending From Base."); } else if (currentArmyScript && Vector2.Distance(GetMousePos(), selectedItem.transform.position) > 0.21f) { currentArmyScript.SetArmyDestination(GetMousePos()); currentArmyScript = null; startSending = false; } else { Debug.Log("Not your base!"); } CleanSelectedItem(); Destroy(armyGuide.gameObject); } }