void OnMouseDown() { //set current operation city ActionButtonManager script = playerActionButton.GetComponent <ActionButtonManager>(); script.SetCurrentCity(GameObject.Find(name)); if (gameManager.OnOperationsExpertAbility) { RaiseEventOptions opt = new RaiseEventOptions { Receivers = ReceiverGroup.All }; PhotonNetwork.RaiseEvent((byte)110, gameManager.OperationsExpertAbilityCard.ToString(), true, opt); PhotonNetwork.RaiseEvent((byte)77, gameManager.OperationsExpertAbilityCard.GetHashCode(), true, opt); gameManager.ActionCallBack(); return; } if (script.disable) { return; } //getting the position of the object city clicked. Debug.Log(name); Vector3 pos = transform.position; pos.x += 70; pos.y += 40; Debug.Log(pos); if (playerActionButton.transform.position == pos) { if (playerActionButton.activeSelf == false) { playerActionButton.transform.position = pos; playerActionButton.SetActive(true); } else if (playerActionButton.activeSelf == true) { playerActionButton.SetActive(false); } } else { playerActionButton.transform.position = pos; playerActionButton.SetActive(true); } }