Kayıtlar

Aralık, 2020 tarihine ait yayınlar gösteriliyor

Popüler Yayınımıza da Göz Atabilirsiniz

Unity Quit Game With Phone Back Button SOLVED!

Resim
      How to exit game or application on Android , Ios or any devices by pressing back button on phone's? This is the topic today.  In this way, we can exit the game, close the menu or change the scene and return to the main menu. 1. Create A New Script and Open          We will write our code on Update function. Escape key means back key for Android, Ios phones.     void Update ()      {                 if ( Input .GetKeyDown( KeyCode .Escape))                   {                           Application .Quit();                   }      }          Or If you want close a menu,  [ SerializeField ] GameObject your_menu;     void Update ()     {               if  ( Input .GetKeyDown( KeyCode .Escape))                 {                         your_menu. SetActive ( false );                 }     } Or change your scene         SceneManager .LoadScene( "MainMenu" ); 2. Add your script at any Gameobject on your scene. 3. And Test On Your Phone