【问题标题】:Unexpected symbol void in unity统一的意外符号无效
【发布时间】:2018-08-01 23:37:07
【问题描述】:

使用void时出现以下错误。

"意外的符号 void、期望的类、委托、枚举、接口、部分或结构"

错误是最后两个空白。

以下是带有脚本和错误的屏幕截图:

这是我产生错误的代码。

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

public class PauseMenu : MonoBehaviour
{
    public static bool GameisPaused = false;

    public GameObject pauseMenuUI;
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (GamseIsPaused)
            {
                Resume();
            }
            else
            {
                Pause();
            }
        }
    }
}

void Resume()
{

    pauseMenuUI.SetActive(false);
    Time.timeScale = 1f;
    GameisPaused = false;
}

void Pause()
    {
        pauseMenuUI.SetActive(true);
        Time.timeScale = 0f;
        GameisPaused = true;
    }

【问题讨论】:

    标签: visual-studio


    【解决方案1】:

    在更新函数之后/恢复之前,您的“}”太多了。删除它!

    【讨论】:

      猜你喜欢
      • 2014-07-14
      • 1970-01-01
      • 1970-01-01
      • 2016-09-25
      • 2015-09-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多