using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class cameraswitch : MonoBehaviour {
public Camera cam1;
public Camera cam2;
void Start () {
cam1.enabled = true;
cam2.enabled = false;
Button Button = gameObject.GetComponent<Button>();
Button.onClick.AddListener(baz);
}
void baz () {
cam1.enabled = false;
cam2.enabled = true;
}
}
this is my code . how to switch between the cameras with one button . and Thank You.