Question by
ScavengerH · Aug 28, 2016 at 08:45 PM ·
error messagestuckbegginer
Why do i get an error ? please help i've stuck for 20 min
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");
}
}
}
Comment
Best Answer
Answer by mj321 · Aug 28, 2016 at 09:09 PM
I think you need Input.GetKeyDown() instead.
Ah you're right! :( i feel really stupid, sorry its a stupid mistake, i'm still a begginer so, but thank you very much :D