// Update is called once per frame
    void Update()
    {
        if (buttonToRebind != null)
        {
            TextPressAKey.SetActive(true);
            if (Input.anyKeyDown)                                                            //If a key has been pressed
            {
                var pressedKey = InputManager.GetPressedKey();
                // Check if that key is already used.
                string alreadyBound = inputManager.GetButtonForKey(pressedKey);
                if (string.IsNullOrEmpty(alreadyBound))
                {
                    // The key is still free so assign it and reload the ui.
                    inputManager.SetButtonForKey(buttonToRebind, pressedKey);
                    LoadList();
                }
                else if (alreadyBound != buttonToRebind)
                {
                    // Create a modal dialog with a text and two buttons.
                    var text = string.Format(MsgAlreadyAssigned, pressedKey.ToString(), alreadyBound, buttonToRebind);
                    // The yes button will perform the binding and reload the ui.
                    var buttonName = buttonToRebind;
                    var yes        = new ModalDialogButton
                    {
                        Label = "Yes", Action = () =>
                        {
                            inputManager.SetButtonForKey(buttonName, pressedKey);
                            LoadList();
                        }
                    };
                    // The no button will do nothing.
                    var no = new ModalDialogButton {
                        Label = "No"
                    };

                    // Show the created dialog.
                    ModalDialog.Instance().ShowDialog(text, new[] { yes, no });
                }
                TextPressAKey.SetActive(false);
                buttonToRebind = null;
            }
        }
    }
 void ShowGdprDialog(Action callback)
 {
     ModalDialog.Instance().Choice(
         () =>
     {
         if (callback != null)
         {
             callback();
         }
         WritePersonalizedAdsConsent(true);
     },
         () =>
     {
         if (callback != null)
         {
             callback();
         }
         WritePersonalizedAdsConsent(false);
     });
 }