実現したいこと
3d脱出ゲームを作るとき、ある個所をクリックすると拡大して見えるようにする
問題になっていること
クリックする箇所に3dオブジェクトのcubeを置き、イベントトリガーでクリック判定を行っているのだが、そこの部分を押すと拡大されて見えるはずの個所が、薄茶色の画面になってしまう。
コンパイルエラーはない
コード ```using System.Collections; using System.Collections.Generic; using UnityEngine; public class camera : MonoBehaviour { public const int frontcamera =1 ; public const int rightcamera=2 ; public const int leftcamera =4 ; public const int backcamera =3; public GameObject FrontCamera; public GameObject RightCamera; public GameObject LeftCamera; public GameObject BackCamera; public GameObject PCcamera; public GameObject nazo1Camera; public GameObject nazo11Camera; public GameObject tansunumberCamera; public GameObject magnetCamera; public GameObject rightbutton; public GameObject leftbutton; public GameObject downbutton; public GameObject nazo1downbutton; public GameObject nazo11downbutton; public GameObject tansunumberdown; public GameObject magnetdown; int nowcamera; // Use this for initialization void Start () { downbutton.SetActive(false); nazo1downbutton.SetActive(false); nazo11downbutton.SetActive(false); tansunumberdown.SetActive(false); magnetdown.SetActive(false); PCcamera.SetActive(false); nazo11Camera.SetActive(false); nazo1Camera.SetActive(false); tansunumberCamera.SetActive(false); magnetCamera.SetActive(false); } // 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: FrontCamera.SetActive(true); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(false); break; case leftcamera: FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(true); RightCamera.SetActive(false); break; case rightcamera: FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(true); break; case backcamera: FrontCamera.SetActive(false); BackCamera.SetActive(true); LeftCamera.SetActive(false); RightCamera.SetActive(false); break; } } public void PushPCCameraButton() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(false); PCcamera.SetActive(true); leftbutton.SetActive(false); rightbutton.SetActive(false); downbutton.SetActive(true); } public void PushPCCameradown() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(true); leftbutton.SetActive(true); rightbutton.SetActive(true); downbutton.SetActive(false); } public void Pushnazo1Button() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(false); nazo1Camera.SetActive(true); leftbutton.SetActive(false); rightbutton.SetActive(false); nazo1downbutton.SetActive(true); } public void Pushnazo1Down() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(true); RightCamera.SetActive(false); leftbutton.SetActive(true); rightbutton.SetActive(true); nazo1downbutton.SetActive(false); } public void Pushnazo11Button() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(false); nazo11Camera.SetActive(true); leftbutton.SetActive(false); rightbutton.SetActive(false); nazo11downbutton.SetActive(true); } public void Pushnazo11Down() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(true); leftbutton.SetActive(true); rightbutton.SetActive(true); nazo11downbutton.SetActive(false); } public void Pushtansunumberbutton() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(false); tansunumberCamera.SetActive(true); leftbutton.SetActive(false); rightbutton.SetActive(false); tansunumberdown.SetActive(true); } public void Pushtansunumberdown() { FrontCamera.SetActive(false); BackCamera.SetActive(true); LeftCamera.SetActive(false); RightCamera.SetActive(false); leftbutton.SetActive(true); rightbutton.SetActive(true); tansunumberdown.SetActive(false); } public void PushmagnetButton() { FrontCamera.SetActive(false); BackCamera.SetActive(false); LeftCamera.SetActive(false); RightCamera.SetActive(false); magnetCamera.SetActive(true); leftbutton.SetActive(false); rightbutton.SetActive(false); magnetdown.SetActive(true); } public void PushmagnetDown() { FrontCamera.SetActive(false); BackCamera.SetActive(true); LeftCamera.SetActive(false); RightCamera.SetActive(false); leftbutton.SetActive(true); rightbutton.SetActive(true); magnetdown.SetActive(false); } } どなたか原因がわかる方はいらっしゃいますか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。