When you are happy and proud of your game, you may want people to write a comment and / or vote for him. Here’s what I use to inform users:

  1. Create a new scene. This scene must be played once and at startup
  2. Create an empty object and add it in the scene
  3. Create a new script : StartupRatingManager .cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using UnityEngine;
    
    namespace Assets.Scripts.Managers
    {
        public class StartupRatingManager : MonoBehaviour
        {
            public void Awake()
            {
                var ratingCount = PlayerPrefs.GetInt("RatingCount", 0);
                if (ratingCount < 0)
                {
                    Application.LoadLevel("MainScene");
                    return;
                }
    
                ratingCount++;
    
                if (ratingCount >= 5)
                {
                    PlayerPrefs.SetInt("RatingNeeded", 1);
                    PlayerPrefs.SetInt("RatingCount", 0);
                    PlayerPrefs.Save();
                    Application.LoadLevel("MainScene");
                    return;
                }
    
                PlayerPrefs.SetInt("RatingNeeded", 0);
                PlayerPrefs.SetInt("RatingCount", ratingCount);
                PlayerPrefs.Save();
    
                Application.LoadLevel("MainScene");
            }
        }
    }
    

    This snippet set a PlayerPref to notify your MainScene to display a popup after 5 launches.

  4. Add this script in the new object
  5. Switch to your main game scene (MainScene in our example)
  6. Create an empty object and add it in the scene
  7. Create another script : RatingManager.cs
    using System;
    
    namespace Assets.Scripts.Managers
    {
        public class RatingPopup
        {
            public Action OnRating;
            public Action OnSendMail { get; set; }
            public Action OnRemindMeLater { get; set; }
    
            public void Show()
            {
                // TODO : Display popup
            }
    
            public void Close()
            {
                // TODO : Close popup
            }
        }
    
        public class RatingManager : MonoBehaviour
        {
            private RatingPopup _popup;
    
            public void Awake()
            {
                if (PlayerPrefs.GetInt("RatingNeeded", 0) == 1)
                {
                    // Create popup and set callbacks
                    _popup = new RatingPopup();
                    _popup.OnRating = RatingCallback;
                    _popup.OnSendMail = SendMailCallback;
                    _popup.OnRemindMeLater = RemindMeLaterCallback;
    
                    PlayerPrefs.SetInt("RatingNeeded", 0);
                    PlayerPrefs.Save();
                }
            }
    
            /// <summary>
            /// User want to rate
            /// </summary>
            public void RatingCallback()
            {
                _popup.Close();
    
                // Never ask again
                PlayerPrefs.SetInt("RatingCount", -1);
                PlayerPrefs.Save();
    
    #if UNITY_WP8
                // TODO : Rating for WP8
    
    #elif UNITY_ANDROID
                // TODO : Rating for Android
    
    #elif UNITY_IOS
                // TODO : Rating for iOS
    
    #else
    
    #endif
            }
    
            /// <summary>
            /// User want to send an email
            /// </summary>
            public void SendMailCallback()
            {
                _popup.Close();
    
                // Never ask again
                PlayerPrefs.SetInt("RatingCount", -1);
                PlayerPrefs.Save();
    
                Application.OpenURL("mailto:apps@xxxxxxxxxx.com");
            }
    
            /// <summary>
            /// User don't want to rate us now, ask him later
            /// </summary>
            public void RemindMeLaterCallback()
            {
                _popup.Close();
    
                PlayerPrefs.SetInt("RatingCount", 0);
                PlayerPrefs.Save();
            }
        }
    }
    

    This snippet displays a popup to the user with 3 choices :

    • Rate us now! (Do not ever ask me)
    • Send a mail (Do not ever ask me)
    • Remind me later (A new notification will be triggered after 5 launches)

      You will need to have your own popup manager !

  8. Add this script in the new object.

Have fun !