Hello Community I’m currently having trouble with my script and i was wandering how to fix it heres my issues
Assets\Scripts\PauseMenu\PauseMenu.cs(6,14): error CS0101: The namespace ‘’ already contains a definition for ‘PauseMenu’
Assets\Scripts\PauseMenu\PauseMenu.cs(12,10): error CS0111: Type ‘PauseMenu’ already defines a member called ‘Update’ with the same parameter types
But im pretty sure its something to do with the EditorApplication on Quit Game side
Here’s my script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PauseMenu : MonoBehaviour
{
public static bool GameIsPaused = false;
public GameObject pauseMenuUI;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (GameIsPaused)
{
Resume();
}
else
{
Pause();
}
}
}
public void Resume()
{
pauseMenuUI.SetActive(false);
Time.timeScale = 1f;
GameIsPaused = false;
}
void Pause()
{
pauseMenuUI.SetActive(true);
Time.timeScale = 0f;
GameIsPaused = true;
}
public void LoadMenu()
{
Time.timeScale = 1f;
SceneManager.LoadScene(“Menu”);
}
public void QuitGame()
{
#if UNITY_EDITOR
Debug.Log(“You have quit the game”);
if (UnityEditor.EditorApplication.isPlaying == true)
{
UnityEditor.EditorApplication.isPlaying = false;
}
#else
Application.Quit();
#endif
}
}