- Home /
Question by
Lumenx · Jan 14, 2018 at 10:22 AM ·
scripting problemerror
Help with an error.
i'm not an expert video game developer and i'm working on some kind of 2D plateformer/shooter and i got this error
Assets/Scripts/PauseMenu.cs(5,14): error CS0101: The namespace global::' already contains a definition for
PauseMenu'
any help?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseMenu : MonoBehaviour {
public string levelSelect;
public string mainMenu;
public bool isPaused;
public GameObject pauseMenuCanvas;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (isPaused) {
pauseMenuCanvas.SetActive (true);
Time.timeScale = 0f;
} else {
pauseMenuCanvas.SetActive (false);
Time.timeScale = 1f;
}
if (Input.GetKeyDown (KeyCode.Escape)) {
PauseUnpause();
}
}
public void PauseUnpause()
{
isPaused = !isPaused;
}
public void Resume ()
{
isPaused = false;
}
public void Quit()
{
Application.LoadLevel (mainMenu);
}
public void LevelSelect ()
{
Application.LoadLevel (levelSelect);
}
}
Comment
Answer by Prastiwar · Jan 14, 2018 at 10:54 AM
It means you have two classes named "PauseMenu" in project.