一、截图
1.创建个ApplicationDemo文件
2.void OnGUI() //创建按钮,不用调用,也是个周期函数
{
if (GUI.Button(newRect(0, 0, 60, 40), "截图"))
{
//1.给个路径,在unity面板里Assets-show in Explorer-新建一个Pictures文件
Application.CaptureScreenshot(@"/Pictures/XK.png");//默认png格式,名字自己设置
Debug.Log("截图成功");
Application.CaptureScreenshot(Application.dataPath + @"/Pictures/XK.png");//会在Assets下创建的Pictures文件夹里显示
}
}
二、游戏关卡设置切换
先创建个ApplicationDemo文件
SceneManager.sceneCountInBuildSettings+"游戏加载关卡总数"
-----------------------------------------------------------------------------------------------
//1.最上面记得加上using UnityEngine.SceneManagement; //记得加上引用这个命名空间
//2.新建个Application2 场景,切换关卡,把两个场景