- 最后登录
- 2021-9-15
- 注册时间
- 2011-7-15
- 阅读权限
- 100
- 积分
- 50625
- 纳金币
- 53202
- 精华
- 32
|
原问题:今天想问大家一个如何用按钮切换相机内容,因为不懂脚本,希望哪位朋友能帮忙写一个
我发一下示意图片吧,方便理解
现在我假设场景里有3个相机,我希望能用按钮切换到对应的相机场景中
答案:、var camera0 : Camera;
var camera1 : Camera;
var camera2 : Camera;
var icon01:Texture;
function OnGUI () {
if(GUI.Button (Rect (Screen.width/2-60,Screen.height-60,50,50), GUIContent (icon01, "Sence01")))
{
camera0.enabled = ***e;
camera1.enabled = false;
camera2.enabled = false;
}
if(GUI.Button (Rect (Screen.width/2,Screen.height-60,50,50), GUIContent (icon01, "Sence02")))
{
camera1.enabled = ***e;
camera0.enabled = false;
camera2.enabled = false;
}
if(GUI.Button (Rect (Screen.width/2+60,Screen.height-60,50,50), GUIContent (icon01, "Sence03")))
{
camera2.enabled = ***e;
camera0.enabled = false;
camera1.enabled = false;
}
}
|
|