Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How Google Play Store works ? Selling Game / DLC and Add-ons

Discussion in 'Android' started by Paatu, Feb 11, 2017.

  1. Paatu

    Paatu

    Joined:
    Feb 5, 2017
    Posts:
    3
    Hello,

    Phase 1:
    My game is free to play, but there is levels which are locked. (open only in pro version).
    Do I just upload my free version to Google Play Store as a "demo" which has levels unaccessible ?.

    Phase 2:
    Now I will upload my PRO version separately to Google Play store which has all levels unlocked.
    How Android knows, PRO version has to replace the free version for user ?

    Phase 3:
    What If I sell levels separately, how does the upgrade progress go ? Do I just release game to Google Play Store which has that exact level opened ? So If I have 5 locked levels, I will upload 5 games to google play store ?

    Didnt find instructions for this progress, is there any ?
    I haven't find solution for this.
    Help appreciated :)
     
  2. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    You need to release a free game with locked levels. Then save your game coins in PlayerPrefs key called Coins or something else.
    Players can earn coins from game,or from video ads or buy from shop. Player can unlock your locked levels with earned coins. Similar to Hill Climb Racing game. This is the best way to earn money.
    Here is my unity ads sample script:

    Code (CSharp):
    1.  
    2.  
    3. using UnityEngine;
    4. using System.Collections;
    5. using UnityEngine.Advertisements;
    6. using UnityEngine.UI;
    7.  
    8. public class UnityAdsIntegration : MonoBehaviour
    9. {
    10.     #if UNITY_ANDROID || UNITY_IOS
    11.     [SerializeField] private string androidGameId = "1865958"; //ID for testing
    12.     [SerializeField] private string iOSGameId = "1885658"; //ID for testing
    13.     public string zoneId = "rewardedVideo";
    14.  
    15.     [Space(3)]
    16.     [SerializeField] bool enableTestMode;
    17.  
    18.  
    19.     [Header("Status Text")]
    20.     public Text StatusText;
    21.  
    22.     [Header("Coins Text")]
    23.     public Text AwardText;
    24.  
    25.     [Header("Awarded Coins")]
    26.     public int AwardedCoins = 1000;
    27.  
    28.     void Start ()
    29.     {
    30.         AwardText.text = "Total Coins : "+PlayerPrefs.GetInt ("Coins").ToString ();
    31.  
    32.         string gameId = null;
    33.  
    34.         #if UNITY_ANDROID
    35.         gameId = androidGameId;
    36.         #endif
    37.         #if UNITY_IOS
    38.         gameId = iOSGameId;
    39.         #endif
    40.  
    41.         if(Advertisement.isInitialized) {
    42.             StatusText.gameObject.SetActive (true);
    43.             StatusText.text = "Unity Ads is already initialized";
    44.         }
    45.         else {
    46.             StatusText.gameObject.SetActive (true);
    47.             StatusText.text = "Failed to initialize Unity Ads";
    48.  
    49.             Advertisement.Initialize(gameId, enableTestMode);
    50.         }
    51.     }
    52.  
    53.  
    54.  
    55.  
    56.     public void Show()
    57.     {
    58.         ShowOptions options = new ShowOptions();
    59.         options.resultCallback = HandleShowResult;
    60.  
    61.  
    62.             Advertisement.Show (zoneId, options);
    63.  
    64.     }
    65.  
    66.  
    67.  
    68.     private void HandleShowResult (ShowResult result)
    69.     {
    70.         switch (result)
    71.         {
    72.         case ShowResult.Finished:
    73.             PlayerPrefs.SetInt ("Coins", PlayerPrefs.GetInt ("Coins") + AwardedCoins);
    74.             AwardText.text = PlayerPrefs.GetInt ("Coins").ToString ();
    75.             break;
    76.         case ShowResult.Skipped:
    77.             StatusText.text =  "Video was skipped";
    78.             break;
    79.         case ShowResult.Failed:
    80.             StatusText.text =  "Video failed to show";
    81.             break;
    82.         }
    83.     }
    84.  
    85.  
    86.     public void LoadLevelName(string name)
    87.     {
    88.  
    89.         UnityEngine.SceneManagement.SceneManager.LoadScene (name);
    90.     }
    91.  
    92.     #endif
    93. }
     
    Last edited: Feb 14, 2017
  3. AgusB

    AgusB

    Joined:
    Jun 20, 2013
    Posts:
    65
    You can upload a free version as a demo and a separate unlocked pro version for a price if one purchase unlocks everything. (You have to set the paid app as paid from the beginning!)

    Or you can upload only one, with the levels locked and use google play apis to check for in app purchases and let your users buy the content they want. Then you check with google servers if the user bought the content and unlock it in the game for them.

    Also, don't store coins or currency in playerprefs, they can be changed easily by editing an xml file in the android folder. You can design your own algorithm to "encrypt" the current value of coins, you can use many playerprefs for this and if you find something doesn't add up you can detect it's been manipulated and punish the user returning their currency to 0. Or you could also use an asset that saves the data more securely (there are some in the asset store).
     
  4. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,793
    I found a fast encrypted PlayerPrefs. I have tested some others that's very slow compare to this one:
    https://www.assetstore.unity3d.com/en/#!/content/35160

    In some reports about game hacking, I'm hear from some developers thats ~90% of peoples try to hack mobile games!!!