How can I make a camera change if i have 4 cameras?

I want the camera to switch 1-4
Controls
Left Arrow - Previous Camera
Right Arrow - Next Camera

I’ve come to asking this as my last resort because i have checked all over google…

There are many different ways to do this, but the easiest and most straightforward way is to:

  1. Create a public Camera array and fill it with each of your cameras in the Inspector
  2. Create an integer variable called
    index (which will correspond to the Camera array)
  3. Make the Left and Right arrow
    keys 1.) decrease/increase the index
    variable respectively, and 2.) enable the camera
    at that index and disable the others

Here’s a fully-commented example:

    public Camera[] cameras;    // Contains each of the cameras
    int index = 0;              // Corresponds to the cameras array

    void Update ()
    {
        // Left-Arrow Key
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            // Decrease the index
            index--;

            // If the index goes below 0, wrap back around to the max number (defined by the array's size)
            if (index < 0)
                index = cameras.Length - 1;

            // Set the camera to whichever one is located at cameras[index]
            ChangeCamera(index);
        }
        // Right-Arrow Key
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            // Increase the index
            index++;

            // If the index goes beyond the max number, wrap back around to 0
            if (index > cameras.Length - 1)
                index = 0;

            // Set the camera to whichever one is located at cameras[index]
            ChangeCamera(index);
        }
    }

    // Performs the actual camera-swapping
    void ChangeCamera (int camIndex)
    {
        // Loop through the entire cameras array, enabling the correct camera and disabling the others
        for (int i = 0; i < cameras.Length; i++)
        {
            // If i matches the current index, enable the camera at that position in the array
            if (i == index)
                cameras*.enabled = true;*

// Otherwise, disable the camera at that position in the array
else
cameras*.enabled = false;*
}
}