Log in or register to post comments

Android back key not working - Unity extension ImageTargets

September 24, 2012 - 8:10pm #1

This is the first time using Unity and Unity extension. I've just built and run Unity extension ImageTargets sample app on a Galaxy S2 device. The teapot is shown on the stones target. 

By the way when I pushed the back key on the device, there is no response, it still shows camera backgound.

What's wrong with this? Any help?

 

 

 

 

Android back key not working - Unity extension ImageTargets

June 6, 2017 - 6:15pm #12

tq very much david beard. The code works well for me

Android back key not working - Unity extension ImageTargets

November 20, 2016 - 9:21am #11

this code didnt working, I've tried

 

Android back key not working - Unity extension ImageTargets

June 14, 2016 - 5:03am #10

Thanks binspaul, this solution worked for me .

Android back key not working - Unity extension ImageTargets

June 14, 2016 - 5:02am #9

binspaul solution worked for me ..
Thanks

Android back key not working - Unity extension ImageTargets

July 10, 2013 - 1:42am #8

Hi,

I have found the way to add the code. The step is:

1. Right click on the 'Assets' section in the Project tab. Then select  'Create' > 'C# Script'.

2. A new script will be added to your 'Assets'. Rename it to a more meaningful file.

3. Double click on that file and the script editor will open. Paste the specified code into the update method. Save and exit the editor.

4. Click on the 'ImageTarget' element in the 'Hierarchy' tab.

5. Click on the 'Add Component' button available in the 'Inspector'. Select 'Script' and then choose the created file.

6. The script will be added to the component. That's all...

Thanks,

Binu Paul

Android back key not working - Unity extension ImageTargets

July 9, 2013 - 6:47am #7

Hi,

Which file should I write the code to? I am pretty new to Unity integration.

Thanks,

Binu Paul

Android back key not working - Unity extension ImageTargets

June 11, 2013 - 10:09am #6

You can add it to the ARCamera or any other GameObject in the Hierarchy. Also be sure that  your script inherits from MonoBehavior..

 

public class BackCatcher : MonoBehaviour
{

       public void Update () {

        if (Application.platform == RuntimePlatform.Android) {

            if (Input.GetKeyUp(KeyCode.Escape)) {

               //quit application on return button

               Application.Quit();

               return;

           }

        }

    }

}

Android back key not working - Unity extension ImageTargets

June 11, 2013 - 5:13am #5

where input the script?? please help me...

Android back key not working - Unity extension ImageTargets

May 10, 2013 - 10:50pm #4

where to put the script??

 

Android back key not working - Unity extension ImageTargets

September 25, 2012 - 1:17am #3

Thanks.

I didn't know that. I thought the back key works in the same way when I use other android apps.

Your code works well.

 

Android back key not working - Unity extension ImageTargets

September 25, 2012 - 1:00am #2

did you assign any functionality to the back key in unity? if not, then that's your answer..

to make the app quit whe you press your back key you need something like this:

function Update () {

        if (Application.platform == RuntimePlatform.Android) {

            if (Input.GetKeyUp(KeyCode.Escape)) {

//quit application on return button

Application.Quit();

return;

    }

        }

}

Log in or register to post comments