zoukankan      html  css  js  c++  java
  • [Unity3D] 如何实现点击按钮退出游戏

     1 using System;
     2 using System.Collections;
     3 using System.Collections.Generic;
     4 using UnityEngine;
     5 using UnityEngine.UI;
     6 
     7 public class ExitGame : MonoBehaviour
     8 {
     9    private void  Start() {
           /*查找按钮组件并添加事件(点击事件)*/
    10 this.GetComponent<Button>().onClick.AddListener(OnClick); 11 } 12 13 /*点击时触发*/ 14 private void OnClick() { 15 /*将状态设置false才能退出游戏*/ 16 UnityEditor.EditorApplication.isPlaying = false; 17 Application.Quit(); 18 } 19 20 21 }
    时间若流水,恍惚间逝去
  • 相关阅读:
    反射自动填充model
    source control tool
    项目管理案例分析
    IOC
    js framework
    WPF 难点内容
    WPF MVVM
    NewSQL
    软件部门员工考核
    JavaScript 中级
  • 原文地址:https://www.cnblogs.com/alanshreck/p/13585204.html
Copyright © 2011-2022 走看看