【Unity3d】GUI笔记

1 GUITest0

function OnGUI() {
    
    GUI.Label(Rect(10,10,100,30),"ChooseLevel");
        //Debug.Log("Clicked the button with an image");
      
    if (GUI.Button(Rect(10,70,50,30),"1"))
        //Debug.Log("Clicked the button with text");
      {Application.LoadLevel(1);}//申请载入场景1
}

2GUITest1

function OnGUI() {
    
    if (GUI.Button(Rect(700,500,50,30),"Right"))
        //Debug.Log("Clicked the button with an image");
      {animation.CrossFade("Right");}
    if (GUI.Button(Rect(500,500,50,30),"Left"))
        //Debug.Log("Clicked the button with text");
      {animation.CrossFade("Left");}
    if (GUI.Button(Rect(800,800,50,30),"Back"))
        //Debug.Log("Clicked the button with text");
      {Application.LoadLevel(0);}//申请载入场景0
}

注:通过点击GUIButton 实现播放动画,场景的切换.场景0和1的确定是在File-Build Settings 把2个场景拖入到Scenes In Build

转载于:https://www.cnblogs.com/wayne1984/archive/2012/08/08/2628340.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值