unity 背景 按钮 场景跳转

public Texture2D pic;

private bool Cl = false;

void OnGUI()   

  {        

GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), pic);        

GUIStyle style = new GUIStyle(); //实例化一个新的GUIStyle,名称为style ,后期使用        

style.fontSize = 50; //字体的大小设置数值越大,字越大,默认颜色为黑色        

style.normal.textColor = new Color(0, 2, 4); //        

GUILayout.Label("太空大战",style);

        if (GUILayout.Button("开始游戏"))

        {

            Cl = true;

            if (Cl)

            {

                Application.LoadLevel("C2");

            }

        }

    }

文件中有两个场景  C1  C2

方法二

posted @ 2016-05-10 09:22  Shinea_SYR  阅读(995)  评论(0编辑  收藏  举报