using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class MenuWnd : MonoBehaviour { //视图索引 private int viewIndex = 0; public Button viewChangeBtn; public GameObject threeDcamera; public GameObject twoDcamera; // Start is called before the first frame update public void Init() { viewChangeBtn.onClick.AddListener(ChangeView); } /// /// 0为3D试图,1为2D视图 /// public void ChangeView() { switch (viewIndex) { case 0: viewIndex = 1; break; case 1: viewIndex = 0; break; } switch (viewIndex) { case 0: twoDcamera.SetActive(false); threeDcamera.SetActive(true); break; case 1: twoDcamera.SetActive(true); threeDcamera.SetActive(false); break; } } }