x


Android: 'back' button event

Hello!

Is there any way to know when 'back' button on the phone is pressed? I'd like to exit the game when this button is pressed, and not hide it (if hidden, after touching the icon the second time - the game resumes from the previous point and does not restart).

thanks

more ▼

asked Aug 21 at 12:33 AM

gnoblin\'s gravatar image

gnoblin
134 3 4 4

Word on the forums is that we'll be able to handle the back button as the escape keycode in the upcoming RC2.

Sep 21 at 06:10 AM Dave 5

Any news on the back button feature?

Oct 06 at 05:30 PM Mani

So was this mapped to escape in the final release?

Oct 26 at 10:03 PM RitchParker
(comments are locked)
10|3000 characters needed characters left
 moderation talk

2 answers:

The "escape" key label appears to be mapped to the back button on the android platform in the final release of Unity 3.0. As far as other mappings I've found that the "menu" key label is mapped to the menu key and that that MonoBehaviours will get an "OnApplicationPause" + true call when the home button is pressed and an "OnApplicationPause" + false when the application is brought back as the current process. I've not found a mapping for the search button as of yet.

more ▼

answered Oct 28 at 04:08 AM

RitchParker\'s gravatar image

RitchParker
91 1 6

(comments are locked)
10|3000 characters needed characters left
 moderation talk

write this your scripts (KeyCode.Escape is code for native "Back" button on Android):

if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); }

No Doubt it will work try this one.i tried also.

more ▼

answered Sep 30 at 02:55 PM

lbalasubbaiahapps\'s gravatar image

Subbu
-39 2 6 7

(comments are locked)
10|3000 characters needed characters left
 moderation talk
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1214
x170

Asked: Aug 21 at 12:33 AM

Seen: 7844 times

Last Updated: Aug 21 at 12:33 AM

powered by Qato - Enterprise Q&A