zoukankan      html  css  js  c++  java
  • Unity3D_最简单的开始界面_结束界面

    Unity3D_最简单的开始界面_结束界面
    开始界面
    结束界面
    开始界面
    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");
    --------------------- 

  • 相关阅读:
    算法导论之贪心算法
    编程过程中遇到的一些细节
    c++11和c99
    面试总结(YY一面)
    python(17):字典
    python(16):元组
    python(15):练习题
    python(14):列表
    python(13):字符串
    python(12):练习题
  • 原文地址:https://www.cnblogs.com/ly570/p/10971078.html
Copyright © 2011-2022 走看看