void Update() { Move(); CheckUnderTile(); if (Input.GetKeyDown(KeyCode.Mouse0)) { Ray cameraRay = Camera.main.ScreenPointToRay(Input.mousePosition); int posX = Mathf.FloorToInt(cameraRay.origin.x); int posY = Mathf.FloorToInt(cameraRay.origin.y); TileObject to = roomManager.currentRoom.GetTileAt(posX, posY); if (to != null) { to.Destroy(); } } }