実現したいこと
スクリプト内に出る、「コントロールは、switchの最後のcaseラベル(’case frontcamera:')から出ることはできません。定数値が必要です。」とでたエラーを解除したい
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class camera : MonoBehaviour {
public int frontcamera =1 ;
public int rightcamera=2 ;
public int leftcamera =4 ;
public int backcamera =3;
public GameObject FrontCamera; public GameObject RightCamera; public GameObject LeftCamera; public GameObject BackCamera; int nowcamera; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void pushrightbutton() {
nowcamera++;
if (nowcamera > leftcamera) { nowcamera = frontcamera; } displaycamera(); } public void pushleftbutton() { nowcamera--; if (nowcamera < frontcamera) { nowcamera = leftcamera; } displaycamera(); } void displaycamera() { switch (nowcamera) { case frontcamera: }
例文にそってcaseをかいたのですが、どうしてもこういったエラーが出てしまいます。
調べても何も出てきませんでした。
どうやったら解決するのか、お力添えの程よろしくお願いします。
}
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/27 10:34
2018/11/27 11:19
2018/11/28 10:16