- Home /
update script
I would like to know if there is a script that makes a message pop up if I post an update for a game. if so what is the script and how do I post the update to the game?
Answer by Joshua · Jul 30, 2011 at 06:23 AM
What you want to do is when you load up your game, using the WWW class, you check if you're running the most up to date version of the game. This could be as easy as throwing a .txt file with the most recent version number in your public folder on dropbox, getting the path and checking the string the WWW will return.
private static var thisVersionNumber : int;
function Start( )
{
var url : String = "http://dl.dropbox.com/u/2325652/My_VersionNumber.txt";
var www : WWW = new WWW (url);
yield www;
var latestNumberString : int = Convert.ToSingle( www.text );
if( latestNumber != thisVersionNumber )
{
//Uh oh, you're running an old version
}
}
What you can do after having done this check is either prompt the user to download a new version of the application, or look into assetbundles.
You want some method of checking with a database on a server if the application you are running is the most up-to-date version. I explained the easiest way to do this.
Your answer
![](https://koobas.hobune.stream/wayback/20220612162505im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Update Script 1 Answer
Public variable in script doesn't update in Unity inspector when saved 1 Answer
my script wont work, even though everytthing is in the right place and 0 errors? 1 Answer
Does a reference to a script have up-to-date info ? 1 Answer
Is enabling and disabling a script component with an Update() function in it a good practice? 2 Answers