OnEscapeQuit.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="OnJoinedInstantiate.cs" company="Exit Games GmbH">
  3. // Part of: Photon Unity Utilities,
  4. // </copyright>
  5. // <summary>
  6. // This component will quit the application when escape key is pressed
  7. // </summary>
  8. // <author>developer@exitgames.com</author>
  9. // --------------------------------------------------------------------------------------------------------------------
  10. using UnityEngine;
  11. using System.Collections;
  12. using System.Diagnostics;
  13. namespace Photon.Pun.UtilityScripts
  14. {
  15. /// <summary>
  16. /// This component will quit the application when escape key is pressed
  17. /// </summary>
  18. public class OnEscapeQuit : MonoBehaviour
  19. {
  20. [Conditional("UNITY_ANDROID"), Conditional("UNITY_IOS")]
  21. public void Update()
  22. {
  23. // "back" button of phone equals "Escape". quit app if that's pressed
  24. if (Input.GetKeyDown(KeyCode.Escape))
  25. {
  26. Application.Quit();
  27. }
  28. }
  29. }
  30. }