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
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:
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
using UnityEngine.UI;
public class UnityAdsIntegration : MonoBehaviour
{
#if UNITY_ANDROID || UNITY_IOS
[SerializeField] private string androidGameId = "1865958"; //ID for testing
[SerializeField] private string iOSGameId = "1885658"; //ID for testing
public string zoneId = "rewardedVideo";
[Space(3)]
[SerializeField] bool enableTestMode;
[Header("Status Text")]
public Text StatusText;
[Header("Coins Text")]
public Text AwardText;
[Header("Awarded Coins")]
public int AwardedCoins = 1000;
void Start ()
{
AwardText.text = "Total Coins : "+PlayerPrefs.GetInt ("Coins").ToString ();
string gameId = null;
#if UNITY_ANDROID
gameId = androidGameId;
#endif
#if UNITY_IOS
gameId = iOSGameId;
#endif
if(Advertisement.isInitialized) {
StatusText.gameObject.SetActive (true);
StatusText.text = "Unity Ads is already initialized";
}
else {
StatusText.gameObject.SetActive (true);
StatusText.text = "Failed to initialize Unity Ads";
Advertisement.Initialize(gameId, enableTestMode);
}
}
public void Show()
{
ShowOptions options = new ShowOptions();
options.resultCallback = HandleShowResult;
Advertisement.Show (zoneId, options);
}
private void HandleShowResult (ShowResult result)
{
switch (result)
{
case ShowResult.Finished:
PlayerPrefs.SetInt ("Coins", PlayerPrefs.GetInt ("Coins") + AwardedCoins);
AwardText.text = PlayerPrefs.GetInt ("Coins").ToString ();
break;
case ShowResult.Skipped:
StatusText.text = "Video was skipped";
break;
case ShowResult.Failed:
StatusText.text = "Video failed to show";
break;
}
}
public void LoadLevelName(string name)
{
UnityEngine.SceneManagement.SceneManager.LoadScene (name);
}
#endif
}
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).