so i'm trying to load "paused screen" whenever the user inputs(presses) the Esc. button, but then i get this error.
The best overloaded method match for `UnityEngine.Input.GetButtonDown(string)' has some invalid arguments
Argument `#1' cannot convert `UnityEngine.KeyCode' expression to type `string'
using UnityEngine;
using System.Collections;
public class LevelManger : MonoBehaviour {
public void loadLevel (string name) {
Debug.Log("New level load: " + name);
Brick.breakableCount = 0;
Application.LoadLevel (name);
}
public void QuitRequest(){
Debug.Log("Quit Requsted");
Application.Quit();
}
public void loadNextLevel() {
Brick.breakableCount = 0;
Application.LoadLevel(Application.loadedLevel + 1);
}
public void brickDestoryed() {
if (Brick.breakableCount <= 0) {
loadNextLevel();
}
}
void Update() {
if (Input.GetButtonDown(KeyCode.Escape)) {
Brick.breakableCount = 0;
Application.LoadLevel ("Paused");
}
}
}
↧