(スクリプト)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
public Camera cam1;
public Camera cam2;
private bool isCam1 = true;
void Start()
{
cam1.enabled = true;
cam2.enabled = false;
}
void Update()
{
if(Input.GetKeyDown(KeyCode.C) && isCam1 == true)
{
cam1.enabled = false;
cam2.enabled = true;
isCam1 = false;
}
else if (Input.GetKeyDown(KeyCode.C) && isCam1 == false)
{
cam1.enabled = true;
cam2.enabled = false;
isCam1 = true;
}
}
}
(設定)