unity 多相机切换镜头

#pragma strict

private var Camera0:GameObject;
private var Camera1:GameObject;
private var Camera2:GameObject;

function Start () {
   Camera0=GameObject.Find("Main Camera");
   Camera1=GameObject.Find("Camera1");
   Camera2=GameObject.Find("Camera2");
}

function OnGUI () {
    if(GUILayout.Button("侧面",GUILayout.Height(50))){
        Camera0.active=false;
        Camera1.active=false;
        Camera2.active=true;
    }
    
    if(GUILayout.Button("正面",GUILayout.Height(50))){
        Camera0.active=false;
        Camera1.active=true;
        Camera2.active=false;
    }
    
    if(GUILayout.Button("阿面",GUILayout.Height(50))){
        Camera0.active=true;
        Camera1.active=false;
        Camera2.active=false;
    }
}



GUI相关内容参考http://blog.csdn.net/you123you/article/details/8480555

你可能感兴趣的:(unity 多相机切换镜头)