hello everyone, i an trying to use a switch statement to compare tags to strings. anyway am getting an error and i cant realy explain why. here is the script
void Update () {
Ray cursorPos = cam.camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(cursorPos, out hit, range)){
blockSide = hit.transform.tag;
switch (blockSide)
{
case "cube_left":
Instantiate(availableBlocks[blockIndexSelected], new Vector3(hit.point.x, hit.point.y, hit.point.z)
, Quaternion.identity);
break;
case "cube_right":
Instantiate(availableBlocks[blockIndexSelected], new Vector3(hit.point.x, hit.point.y, hit.point.z)
, Quaternion.identity);
break;
case "cube_up":
Instantiate(availableBlocks[blockIndexSelected], new Vector3(hit.point.x, hit.point.y, hit.point.z)
, Quaternion.identity);
break;
case "cube_down":
Instantiate(availableBlocks[blockIndexSelected], new Vector3(hit.point.x, hit.point.y, hit.point.z)
, Quaternion.identity);
break;
case "cube_front":
Instantiate(availableBlocks[blockIndexSelected], new Vector3(hit.point.x, hit.point.y, hit.point.z)
, Quaternion.identity);
break;
case "cube_back":
Instantiate(availableBlocks[blockIndexSelected], new Vector3(hit.point.x, hit.point.y, hit.point.z)
, Quaternion.identity);
break;
default:
Debug.Log("da'hell am i supposed to do with this?");
}
(sorry its so long, but its pretty repetitive) anywhy, the mistake im getting is the following:
Assets/Scripts/Place_Blocks.cs(23,25): error CS0163: Control cannot fall through from one case label to another
i got absolutely no idea what is going on, if someone could help me find the problem, and if possible a solution it would be much apreciated. thanks a lot everyone.