- Home /
Stop back key android from quitting application WHILE the scene is loading?
Hello. I'm using Unity 4.3.4.
If I press back key on android phone while the scene is loading, the entire application quits. I have already known the code below.
if (Input.GetKeyDown(KeyCode.Escape))
{
return;
}
But this solution only work if scene is loading completely. I have already add DonDestroyOnLoad to script, but nothing changes.
If anyone find out solution, pls let me know. Thank in advance
Answer by SteelArrow21 · May 27, 2014 at 02:56 AM
Rather than doing: return; try: end;
What is the "end"? There nothing like this in Unity. Can you be more specific?
Sorry, I'm thinking of another program. Is this possible?
If(Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Escape))
{
return null;
}
No, same as before: only work if the scene is completely loading, no effect WHILE the scene loading. I have already tried DonDestroyOnLoad, but not fix.
Is this line of code in the same script as the level loading script? If it is, then move it. While the level is loading, all the other code in the script pauses. $$anonymous$$ake a separate script for the backing out and make sure its enabled.
I have tried add another script contains Back-key process code (on same GameObject) and outside the script contains Level-loading code but no work at all. $$anonymous$$aybe I have missed something. Anyway, thank for your help.
Your answer
Follow this Question
Related Questions
Scene load before video (Handled Android) 0 Answers
Help with Exception: Error building Player on Android 2 Answers
Android Error 0 Answers
How do I detect if a scene is being loaded during edit time? 5 Answers