Question by
KristianGrytdal · Oct 14, 2016 at 10:02 PM ·
c#buttonscene-loadingkeycode
if (Input.GetKey (KeyCode.Escape)) Won't Work.
Hey, I'm trying to make it so if you push the back button on your phone it activates the ChangeToScene. The ChangeToScene is on a button, but I want to be able to activate it by pushing the normal back button on my phone. Thanks in advance for any help :)
Here is my the script:
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;
public class changeScene : MonoBehaviour {
public void ChangeToScene (string sceneToChangeTo) {
SceneManager.LoadScene(sceneToChangeTo);
}
public static bool GetKeyEscape(KeyCode Key){
if (Input.GetKey (KeyCode.Escape)) {
SceneManager.LoadScene (sceneToChangeTo);
}
}
}
Comment