public void rotation() { if (rotate) { switch (select) { case 0: { pin.Rotate(new Vector3(0, speed, 0)); break; } case 1: { pin.Rotate(new Vector3(0, 0, -speed)); break; } case 2: { pin.Rotate(new Vector3(speed, 0, 0)); break; } case 3: { pin.Rotate(new Vector3(0, 0, speed)); break; } case 4: { pin.Rotate(new Vector3(-speed, 0, 0)); break; } case 5: { pin.Rotate(new Vector3(0, -speed, 0)); break; } } if (count >= 90) { rotate = false; count = 0; cubeData.Rotate(select); select = -1; cubeData.resetParent(); } count += speed; } }