Updating
Well for at least checking if you updated the App you could store and compare the Application.version
This function returns the current version of the Application. This is read-only. To set the version number in Unity, go to Edit → Project Settings → Player and open the Other Settings tab.
public class VersionCheck : MonoBehaviour
{
private void Awake()
{
var version = PlayerPrefs.GetString("Version", string.Empty);
if (string.IsNullOrWhiteSpace(version))
{
// Probably not more to do since there is no stored data apparently
// Just to be sure you could still do
PlayerPrefs.DeleteAll();
// => THIS IS THE FIRST RUN
PlayerPrefs.SetString("Version", Application.version);
}
else
{
if(version != Application.version)
{
// => THIS IS A VERSION MISMATCH -> UPDATED
PlayerPrefs.DeleteAll();
PlayerPrefs.SetString("Version", Application.version);
}
// else
//{
// // Otherwise it could either mean you re-installed the same version
// // or just re-started the app -> There should be no difference between these two in behavior of your app
//}
}
}
}
Re-Installing
For a re-install: Would it matter? Actually if you install the same version then there should be no difference between running the again installed code or running the previously existing one again.
So I would suggest to rather add an option for the user to clear the data if it is needed.