- Home /
Android back button not working
So as above the back button doesn't work as per the following code :-
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
SceneManager.LoadScene("MainMenu");
}
}
I've tested it on 2 devices and also in Unity remote, additionally, I've tried Input.GetKey
but still nothing is happening.
I've had a good look around the net for solutions but no joy so any help would be greatly appreciated.
Hi all, i am also looking for this solution. Could anyone please guide?
Have you tried the answer given here to know which key was pressed? It may help you diagnose the problem and solve it.
Answer by ahmadneh · Feb 11, 2018 at 06:27 PM
@yewchunyen you should put "escape" instead of KeyCode.Escape
Answer by GreyMiller · Dec 21, 2019 at 05:51 PM
I have the same issue. Eventually I've come to the same code as @Kinkladze11 . Tried also Input.GetKeyDown("escape"), but it makes no difference. The problem is not with LoadScene function, GetKeyDown just never returns true. Tried it on Samsung Galaxy S5 mini. Btw, the Unity Remote app itself doesn't react on back button too