hyhy904

开始界面
1、创建一个新的场景
添加button

2、C#脚本
LoadingGame.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LoadingGame : MonoBehaviour
{
public void LoadGame()
{
Application.LoadLevel("mianScene");
}
}
1
2
3
4
5
6
7
8
9
10
11
3、建一个空对象
将LoadingGame.cs拖入


4、添加到button中

5、在Building Settings中加入两个场景

 

然后就可以尝试运行啦~

结束界面
同理——结束界面
endGame.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class endGame : MonoBehaviour
{
public void EndGame()
{
UnityEditor.EditorApplication.isPlaying = false;
Application.Quit();
}
}
1
2
3
4
5
6
7
8
9
10
11
12
调用

Application.LoadLevel("endGame");
--------------------- 

分类:

技术点:

相关文章:

  • 2022-01-28
  • 2021-10-02
  • 2022-01-07
  • 2021-05-16
  • 2022-01-16
  • 2021-10-16
  • 2021-07-27
  • 2021-11-13
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案