(スクリプト)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CamController : MonoBehaviour
{
public Camera mainCam;
public Camera subCam;
void Start()
{
mainCam.enabled = true;
subCam.enabled = false;
}
void Update()
{
if(Input.GetKeyDown(KeyCode.Space))
{
if(mainCam.enabled) // MainCameraがオンの時
{
mainCam.enabled = false;
subCam.enabled = true;
}
else // MainCameraがオフの時
{
mainCam.enabled = true;
subCam.enabled = false;
}
}
}
}