Options Menu

An options menu prefab with options that games typically need. These features include the ability to control audio and haptic, GDPR via a privacy button, a restore purchases button, a feedback button, social links and user information.


Installation


Integration

  • Right mouse click on *any UI canvas gameObject, and Select LionStudios → OptionsMenu → OpenMenuButton. It will create a prefab instance of OpenMenuButton under the selected UI canvas gameObject.

    • OpenMenuButton is a simple UI button that opens LionOptionsCanvas
  • Position the button appropriately in your UI

  • Implement the RestorePurchase callback

    LionOptionsMenu.RestorePurchase += () =>
    {
        //Handle restore purchase here
    };
    

Optional steps:

  • Go to Gameobject -> LionStudios -> OptionsMenu and select LionOptionsCanvas.
  • LionOptionsCanvas prefab instance will be created in Hierarchy. It a self-sufficient canvas that contains the usual game options.
  • Customize the UI of the button and menu to your needs

Settings

  • Settings included in LionStudios -> Settings Manager -> Options Menu:
    • Feedback Email:

      • ⚠️ This setting will only be used if Helpshift is not installed Helpshift - Customer Support
      • This email will be used as the receiver address for the “Feedback button”, which opens the user’s email app and allows them to directly provide feedback about the app. It should be set to the developer’s email. If left empty, hello@lionstudios.cc will be used.
    • Social Buttons:

      • Enable this to display the “Connect with us” section, which provides links to our social networks. This should be disabled for games that are not officially on Lion Studios account yet.
    • Youtube Icon:

      • Enable this to display the Youtube social button. This is disabled by default because Google sometimes rejects games with youtube links if it thinks they are appealing to kids.
    • Audio:

      • Enable this to display the Audio Button in the menu.

      • Audio Option Type

        • Toggle: the audio option will be a On/Off toggle
        • Slider: the audio option will be a slider, allowing volume control
    • Haptic:

      • Enable this to display the Haptic Button in the menu.

Advanced Setup

You can also place options menu elements independently, to integrate them inside an already existing UI.

Following are the elements that can be used independently. You can use the prefab as it is, once created, or create a prefab variant out of it.

To create prefab variants, you just need to drag n drop the newly created prefab from Hierarchy to your own path anywhere in Assets folder or subfolder.

All menu elements:

Right click on any gameObject (usually UI object) in Hierarchy. Go to LionStudios → OptionsMenu → .. .Select & click on any one of the below options. A new prefab instance of it will be created under the selected gameObject.

Details on the menu elements,

  • SoundSlider
    • This slider will control the game’s AudioListener volume
    • The value will be saved to the device and reloaded whenever the menu is reopened on a future session.
    • To access this value use: SoundSlider.status
  • SoundButton
    • This button will control the game’s AudioListener’s toggle
    • The value will be saved to the device and reloaded whenever the menu is reopened on a future session
    • To access this value, use: SoundButton.status
    • To detect value changes, use the callback LionOptionsMenu.OnAudioToggleChanged
  • HapticButton
    • This button will control the game’s Haptic toggle
    • Currently , All Lion games use Feel as their Vibration and haptic control asset, so the code to control those properties from FEEL have been included to the button functionality.
    • The value will be saved to the device and reloaded whenever the menu is reopened on a future session.
    • To detect value changes, use the callback LionOptionsMenu.OnHapticToggleChanged
  • PrivacyButton
    • This button will only appear in GDPR compliant countries.
    • When clicked, it will showcase the Max Consent flow privacy popup, and invoke the LionOptionsMenu.PrivacyButtonClicked callback.
  • RestoreButton
    • This button will invoke an event callback (RestorePurchase) that developers can subscribe to and perform their restore purchase functionality (See Public Events ).
    • This button will only appear on iOS devices.
    • To detect if the button is clicked, use the callback LionOptionsMenu.RestorePurchase
  • FeedbackButton
    • If helpshift is installed (Helpshift - Customer Support)
      • Helpshift support window will be opened
    • If helpshift is not installed
      • The player mail app will be opened with a prefilled email that will be directed to the developers email, and contains useful info (version number, device ADID, and IDFV).
      • The dev’s email is set via the Settings Manager. More detail ahead in “ Configuring the Options Menu Settings” part.
    • To detect if the button is clicked, use the callback LionOptionsMenu.OnFeedbackButtonClicked
  • AppInfo
    • The bottom of the options panel includes information about the device and game. The first value is the ADID of the user. The text on the right includes the app version number.
    • The ADID and version number have “tap to copy” functionality. Click on the numbers to copy them to your clipboard.
  • LionSocials
    • This container contains all the social links to the various Lion Studios Social platforms.
    • Devs can use LionSocials prefab as a whole or they can also use social buttons prefab individually. Following are the buttons if prefabs are used individually,
      • FacebookButton
        • A simple image button that will open Lion Studios Facebook Page.
      • InstagramButton
        • A simple image button that will open Lion Studios instagram page.
      • TwitterButton
        • A simple image button that will open Lion Studios twitter page.
      • WebButton
        • A simple image button that will open Lion Studios web page.
      • YoutubeButton
        • A simple image button that will open Lion Studios youtube page
  • DeleteProgressButton
    • The Delete Progress button supports user privacy, and gives the user the ability to start the game over.
    • When Delete Progress is pressed, it will show a confirmation popup:
  • DeleteProgressConfirmation
    • When the Confirm button is pressed:
      • All data saved locally (PlayerPrefs) will be deleted
      • All user data on the Nakama server will be deleted (if applicable)
      • If a custom callback is subscribed by the game code, it will be executed
      • On android, the app will restart. On iOS, the app will close
      • You can subscribe a custom callback to LionCore.OnDeleteProgressConfirmed and it will be executed when confirm delete progress button is clicked.

Code Features

Make sure to add the “using namespace LionStudios.Suite.OptionsMenu;”

Public Methods

  • LionOptionsMenu.Instance.Show()
    • Use this method to open the options menu popup by code
  • LionOptionsMenu.Instance.Close()
    • Use this method to close the options menu popup by code

Public Events

  • OnOptionsOpened

    • This event will be invoked whenever the options panel is opened
  • OnOptionsClosed

    • This event will be invoked whenever the options panel is closed
  • OnFeedbackButtonClicked

    • This event will be invoked whenever the feedback button is clicked
  • OnPrivacyButtonClicked

    • This event will be invoked whenever the privacy button is clicked
  • OnAudioToggleChanged

    • This event will be invoked whenever audio button is clicked
  • OnHapticToggleChange

    • This event will be invoked whenever haptic button is clicked
  • OnRestorePurchase

    • This event will be invoked whenever a player clicks on the “Restore” button.
    • Developers are expected to subscribe to this method and handle purchase restoration on their own
    LionOptionsMenu.OnOptionsOpened += () =>
    {
        Debug.Log("Lion Options menu is OPENED");
    };
    
    LionOptionsMenu.OnOptionsClosed += () =>
    {
        Debug.Log("Lion Options menu is CLOSED");
    };
    
    LionOptionsMenu.OnFeedbackButtonClicked += () =>
    {
        Debug.Log("Feedback button was clicked");
    };
    
    LionOptionsMenu.PrivacyButtonClicked += () =>
    {
        Debug.Log("Privacy button clicked, do something...");
    };
    LionOptionsMenu.OnAudioToggleChanged += (audioStatus) =>
    {
        Debug.Log("Audio toggle status changed, do something..."+audioStatus);
    };
    LionOptionsMenu.OnHapticToggleChanged += (hapticStatus) =>
    {
        Debug.Log("Haptic toggle status changed, do something..."+hapticStatus);
    };
    
    LionOptionsMenu.RestorePurchase += () =>
    {
        Debug.Log("Handle restore purchase here");
    };
    
    LionCore.OnDeleteProgressConfirmed += () => 
    {
    		Debug.Log("Game specific delete progress code here");
    };