Unity - 菜鸡自啄 - 切换摄像机
摄像机的切换较为简单,主要通过控制摄像机组件的setactive来实现。话不多说,上代码。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangeCamera : MonoBehaviour {
public GameObject camera_0;
public GameObject camera_1;
public GameObject camera_2;
// Use this for initialization
void Start () {
camera_0.SetActive(false);
camera_1.SetActive(true);
camera_2.SetActive(false);
//场景开始,开启正视图
}
// Update is called once per frame
void Update () {
}
//开启俯视图
public void OnClick_TopView()
{
camera_0.SetActive(true);
camera_1.SetActive(false);
camera_2.SetActive(false);
}
//