So Im Making A car Game And I wanna know who to make.....

So Im Making A car Game And I wanna know who to make a camera switcher with one button please help i have a script that has four buttons for switching but i just want one Help!!!

using UnityEngine;

public class NewBehaviour : MonoBehaviour {
    public GameObject camera1;
    public GameObject camera2;
    public GameObject camera3;
    public GameObject camera4;
    public Texture texture;

    void Start() {
        camera1.SetActive(true);
        camera2.SetActive(false);
        camera3.SetActive(false);
        camera4.SetActive(false);       
    }
   
    void OnGUI() {
        if(GUI.Button(new Rect(0, 0, 100, 100), texture)) {
            camera1.SetActive(true);
            camera2.SetActive(false);
            camera3.SetActive(false);
            camera4.SetActive(false);
        }
        if(GUI.Button(new Rect(100, 0, 100, 100), texture)) {
            camera1.SetActive(false);
            camera2.SetActive(true);
            camera3.SetActive(false);
            camera4.SetActive(false);
        }
        if(GUI.Button(new Rect(200, 0, 100, 100), texture)) {
            camera1.SetActive(false);
            camera2.SetActive(false);
            camera3.SetActive(true);
            camera4.SetActive(false);
        }
        if(GUI.Button(new Rect(300, 0, 100, 100), texture)) {
            camera1.SetActive(false);
            camera2.SetActive(false);
            camera3.SetActive(false);
            camera4.SetActive(true);
           
        }
    }
}

Thanks

Darkdragon

Do you mean something like this?

using UnityEngine;

public class NewBehaviour : MonoBehaviour
{
    public GameObject camera1;
    public GameObject camera2;
    public GameObject camera3;
    public GameObject camera4;
    public Texture texture;

    int currentView = 0;

    void Start()
    {
        camera1.SetActive(true);
        camera2.SetActive(false);
        camera3.SetActive(false);
        camera4.SetActive(false);
    }

    void OnGUI()
    {
        if (GUI.Button(new Rect(0, 0, 100, 100), texture))
        {
            switch (currentView)
            {
                case 0:
                    camera1.SetActive(true);
                    camera2.SetActive(false);
                    camera3.SetActive(false);
                    camera4.SetActive(false);

                    break;
                case 1:
                    camera1.SetActive(false);
                    camera2.SetActive(true);
                    camera3.SetActive(false);
                    camera4.SetActive(false);

                    break;
                case 2:
                    camera1.SetActive(false);
                    camera2.SetActive(false);
                    camera3.SetActive(true);
                    camera4.SetActive(false);

                    break;
                case 3:
                    camera1.SetActive(false);
                    camera2.SetActive(false);
                    camera3.SetActive(false);
                    camera4.SetActive(true);

                    break;
            }

            currentView = (currentView + 1) % 4;
        }
    }
}

Yes thank you so much!!!

and if i use the vehicles asset pack could i use the car scripts on other cars??