相关疑难解决方法(0)

如何退出独立模式或编辑器模式

我在 Windows 10 64 位上使用 unity 5.4.1f1 Personal

我将解释我所做的所有步骤以及迄今为止我尝试过的所有事情。

我第一次使用原始代码创建了一个新的 c# 文件: 现在,当我按 Escape 键时,它将返回编辑器,但不会退出游戏!使用[InitializeOnLoad]时,您无法停止编辑器播放按钮并退出游戏。要退出游戏,您只能在独立模式下使用“构建并运行”来完成,然后您可以使用 Application.Quit();

using UnityEditor;
using UnityEngine;
using System.Collections;

[InitializeOnLoad]
public class FullscreenPlayMode : MonoBehaviour {

    //The size of the toolbar above the game view, excluding the OS border.
    private static int tabHeight = 22;

    static FullscreenPlayMode()
    {
        EditorApplication.playmodeStateChanged -= CheckPlayModeState;
        EditorApplication.playmodeStateChanged += CheckPlayModeState;

        EditorApplication.update += Update;

    }

    static void CheckPlayModeState()
    {
        if (EditorApplication.isPlaying)
        {
            FullScreenGameWindow();
        }
        else 
        {
            CloseGameWindow();
        }
    }

    static EditorWindow GetMainGameView(){
        EditorApplication.ExecuteMenuItem("Window/Game");

        System.Type …
Run Code Online (Sandbox Code Playgroud)

c# unity-game-engine

1
推荐指数
1
解决办法
1432
查看次数

标签 统计

c# ×1

unity-game-engine ×1