Unity3D笔记十三 摄像机之间切换

Unity3D笔记十三  摄像机之间切换

 

 

Unity3D笔记十三  摄像机之间切换
using UnityEngine;
using System.Collections;

public class _5_6 : MonoBehaviour
{


    private GameObject camera0;

    private GameObject camera1;

    private GameObject camera2; 


    /// <summary>
    /// 获取3个摄像机对象
    /// </summary>
    void Start ()
    {
        camera0 = GameObject.Find("Camera0");
        camera1 = GameObject.Find("Camera1");
        camera2 = GameObject.Find("Camera2");
    }

    private void OnGUI()
    {
        if (GUILayout.Button("投射侧面", GUILayout.Height(50)))
        {
            //关闭Camera1与Camera2
            camera1.active = false;//表示取消该摄像机的显示
            camera2.active = false;
            //打开Camera0
            camera0.active = true;//表示激活摄像机使其显示在屏幕中
        }

        if (GUILayout.Button("投射正面", GUILayout.Height(50)))
        {
            //关闭Camera0与Camera2
            camera0.active = false;
            camera2.active = false;
            //打开Camera1
            camera1.active = true;
        }
        if (GUILayout.Button("投射上面",GUILayout.Height(50)))
        {
            //关闭Camera0与Camera1
            camera0.active = false;
            camera1.active = false;
            //打开Camera2
            camera2.active = true;
        }
    }

    // Update is called once per frame
    void Update () {
    
    }
}
Unity3D笔记十三  摄像机之间切换

Unity3D笔记十三 摄像机之间切换

上一篇:在链表中找到第一个含有某值的结点并且删除该结点.


下一篇:maven-plugins说明