Unity3D: Android Back button

Trabla:  Unity3D: Android Back button


Solving:

In Unity3D Android Back button is mapped to KeyCode.Escape

Example 1:

void Update(){ 

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

Example 2:

if (Application.platform == RuntimePlatform.Android)
        {
            if ( Input.GetKey( KeyCode.Escape) )
            {
                // Insert Code Here ( load scene etc. )
                // OR Application.Quit();

                return;
            }

No comments:

Post a Comment