unity3d相机切换效果
U吧论坛以前好像有发过类似教程,权当补充吧!
var camera0 : Camera;
var camera1 : Camera;
function Update () {
if (Input.GetKey ("1"))
{
camera1.enabled = true;
camera0.enabled = false;
}
if (Input.GetKey ("2"))
{
camera1.enabled = false;
camera0.enabled = true;
}
}
function OnGUI () {
GUI.Box (Rect (10,10,100,90), "Camera Switch");
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if (GUI.Button (Rect (20,40,80,20), "Camera 1")) {
camera1.enabled = true;
camera0.enabled = false;
}
// Make the second button.
if (GUI.Button (Rect (20,70,80,20), "Camera 2")) {
camera1.enabled = false;
camera0.enabled = true;
}
}

只能两个。多个相机。可以切换。但是有时候会乱。
好