Hi, is there a way to automatically check for new updates? When a new update is available, you can go to the Play Store with a link and download it. Is that possible? Thanks in advance.
If you need to force your own update you probably need to host your own notion of what is the necessary version number (such as on your own website) and have your app check each time it starts. While fairly simple, it is a lot of work and moving parts to maintain ove rtime, and if you don't need it, just leave it because most people (well over 95%) have their phones set to automatic update and they will get an update within a day or two. How much work do you want to do to reduce that tiny timespan?
I want to make it like the men in the video here: And my question is: Can i make a short short query like if (application.version < newVersion) (i know that the example does not work. Just for the idea.)
Yes, but you still need to get the newVersion value to your old application in the field. See hosting it on your own webserver as I listed above.
Ok, and what if i change the newVersion Value manuelly, every time I launch a new Update? Just an idea
That's my question. With Application.version you can get the oldVersion on which the player is playing atm. But i don't know how to write (example: 1.2.56) and in which operator.
You can split the application version string up and parse it from major, minor and version separately. https://www.geeksforgeeks.org/compare-two-version-numbers/
Works fine! I added it to my Loading Scene and check if the player can do an upgrade. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; using System; public class LoadingScript : MonoBehaviour { [SerializeField] private Image progressBar; [SerializeField] private Text percentLoadText; void Start() { StartCoroutine(LoadingAsyncOperation()); Version(); } IEnumerator LoadingAsyncOperation() { yield return null; AsyncOperation loadGame = SceneManager.LoadSceneAsync(1); loadGame.allowSceneActivation = false; while (!loadGame.isDone) { progressBar.fillAmount = loadGame.progress; percentLoadText.text = (loadGame.progress * 100).ToString("F0") + "%"; if (loadGame.progress >= 0.9f) { progressBar.fillAmount = 1f; percentLoadText.text = "100%"; } yield return null; } } static int VersionCompare(string v1, string v2) { // vnum stores each numeric // part of version int vnum1 = 0, vnum2 = 0; // loop until both string are // processed for (int i = 0, j = 0; (i < v1.Length || j < v2.Length);) { // storing numeric part of // version 1 in vnum1 while (i < v1.Length && v1[i] != '.') { vnum1 = vnum1 * 10 + (v1[i] - '0'); i++; } // storing numeric part of // version 2 in vnum2 while (j < v2.Length && v2[j] != '.') { vnum2 = vnum2 * 10 + (v2[j] - '0'); j++; } if (vnum1 > vnum2) return 1; if (vnum2 > vnum1) return -1; // if equal, reset variables and // go for next numeric part vnum1 = vnum2 = 0; i++; j++; } return 0; } static void Version() { string versionNew = "1.0.5"; string versionOld = Application.version; if (VersionCompare(versionNew, versionOld) < 0) Debug.Log("Up-to-date!"); else if (VersionCompare(versionNew, versionOld) > 0) Debug.Log("Update Game!"); else Debug.Log("Up-to-date!"); } }
Hi, I found a problem with the Script. For example: Player has version 1.0.0 and install 1.0.1 . In this version there is the string (versionNew) 1.0.1 too. If I launch a new update, the value (versionNew) is still 1.0.1 . This Script don't work for this thing. What can i do instead of this? @Kurt-Dekker ?