void Update() { if (client == null) { Debug.LogError("No client assigned to BlockCharacter component!"); return; } if (PlayerID == client.ID) { if (Vector3.SqrMagnitude(transform.position - lastPosition) > 0.1f || Vector3.SqrMagnitude(transform.eulerAngles - lastRotation) > 5f) { SendTransform(); } if (Input.GetMouseButtonDown(0)) { //Get a point 2 meters in front of the center-point of the camera Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 2f)); //Destroy the block there! blockWorld.DestroyBlock(pos); } if (Input.GetMouseButtonDown(1)) { //Get a point 2 meters in front of the center-point of the camera Vector3 pos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 2f)); //Place a block there! blockWorld.AddBlock(pos); } } }