// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { NetworkAPI.SendAttackMessage(ClientAPI.GetTargetOid(), "strike", false); ClientAPI.ClearTarget(); } if (mouseOverObject == null && Camera.main != null) { AtavismNode hoverObject = null; GameObject mouseOver = null; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; // Casts the ray and get the first game object hit if (Physics.Raycast(ray, out hit, Mathf.Infinity, layerMask)) { mouseOver = hit.transform.gameObject; } // Get objectnode from object if (mouseOver != null) { hoverObject = mouseOver.GetComponent <AtavismNode>(); } _UpdateContextCursor(hoverObject); // Handle mouse clicks if (Input.GetMouseButtonDown(0) && !IsMouseOverUI()) { OnLeftClick(true, hoverObject); } if (Input.GetMouseButtonUp(0) && !IsMouseOverUI()) { OnLeftClick(false, hoverObject); } if (Input.GetMouseButtonDown(1) && !IsMouseOverUI()) { OnRightClick(true, hoverObject); } if (Input.GetMouseButtonUp(1) && !IsMouseOverUI()) { OnRightClick(false, hoverObject); } } }