Inheritance: MonoBehaviour
 //! Handle the Singleton object
 void Awake()
 {
     if (back_button_handler == null)
     {
         DontDestroyOnLoad(gameObject);
         back_button_handler = this;
     }
     else if (back_button_handler != this)
     {
         Destroy(gameObject);
     }
 }
        /// <summary>
        /// Registers a custom back button handler for this ViewModel.
        /// </summary>
        /// <param name="vm">The ViewModel.</param>
        /// <param name="handle">The async handler method.</param>
        /// <param name="canHandle">The optional canHandle function. When null is provided, the default behavior is applied (canHandle returns true only when the current ViewModel is active in the <see cref="ISectionsNavigator"/>).</param>
        /// <param name="handlerName">The optional name of the handler. When null is provided, the ViewModel type name is used.</param>
        /// <param name="priority">The optional priority. (See <see cref="IBackButtonManager.AddHandler(IBackButtonHandler, int?)"/> for more info.)</param>
        public static void RegisterBackHandler(this IViewModel vm, Func <CancellationToken, Task> handle, Func <bool> canHandle = null, string handlerName = null, int?priority = null)
        {
            vm          = vm ?? throw new ArgumentNullException(nameof(vm));
            handlerName = handlerName ?? vm.GetType().Name;
            handle      = handle ?? throw new ArgumentNullException(nameof(handle));
            canHandle   = canHandle ?? DefaultCanHandle;

            var backButtonManager = vm.GetService <IBackButtonManager>();
            var handler           = new BackButtonHandler(handlerName, canHandle, handle);
            var registration      = backButtonManager.RegisterHandler(handler, priority);

            vm.AddDisposable("BackButtonHandler_" + handlerName, registration);

            bool DefaultCanHandle()
            {
                var navigator = vm.GetService <ISectionsNavigator>();

                // The handler can handle the back only if the associated ViewModel is the one currently active in the navigator.
                return(navigator.GetActiveViewModel() == vm);
            }
        }
	void OnEnable () {
		backButton = FindObjectOfType<BackButtonHandler> ();
		backButton.gameState = BackButtonHandler.GameState.Menu;
		backButton.menuObject = gameObject;
	}
	void OnEnable () {
		backButton = FindObjectOfType<BackButtonHandler> ();
		backButton.gameState = BackButtonHandler.GameState.Settings;
		backButton.settingsObject = gameObject;
	}