void UpdateBuildingPreview() { Ray ray = mainCamera.ScreenPointToRay(Mouse.current.position.ReadValue()); if (Physics.Raycast(ray, out RaycastHit hit, Mathf.Infinity, floorMask)) { buildingPreviewInstance.transform.position = hit.point; if (!myPlayer.CanPlaceBuildingHere(building, hit.point)) { mat.color = new Color(defaultColor.r, defaultColor.g, defaultColor.b, .25f); } else { mat.color = new Color(defaultColor.r, defaultColor.g, defaultColor.b, 1f); } if (!buildingPreviewInstance.activeSelf) { buildingPreviewInstance.SetActive(true); } } }