【发布时间】:2021-04-11 17:48:15
【问题描述】:
我正在尝试统一制作暂停菜单,但它说我无法公开功能。为什么我不能?
它说
CS0106 修饰符“public”对此项无效 Assembly-CSharp、Assembly-CSharp.Player C:\Users\Jaspin\CubeGame\Assets\UI\Paused\PauseMenu.cs 47 Active
三个人都有。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseMenu : MonoBehaviour
{
public GameObject pauseMenuUI;
public static bool GameIsPaused = false;
void Start()
{
pauseMenuUI.SetActive(false);
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
} else
{
Pause();
}
}
void Resume()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}
void Pause()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
public void LoadMenu()
{
Debug.Log("Loading menu...");
}
public void QuitGame()
{
Debug.Log("Quiting game...");
}
}
}
【问题讨论】:
-
您的简历(等)是功能,本地要更新。你错过了一个}
标签: c# visual-studio unity3d game-development