void Update()
{
if(Input.GetKeyUp(KeyCode.Z))
{
// Increment the camera index to the next camera in the list
currentCameraIndex++;
if(characterCameras.Count == currentCameraIndex)
{
currentCameraIndex = 0;
}
// loop over the camera list, disabling all but the chosen index
foreach(Camera camera in characterCameras)
{
if(camera == characterCameras[currentCameraIndex])
{
camera.enabled = true;
}
else
{
camera.enabled = false;
}
}
}
}