diff --git a/_DOTween.Assembly/DOTween/DOTween.cs b/_DOTween.Assembly/DOTween/DOTween.cs index 8547601..e7d52a7 100644 --- a/_DOTween.Assembly/DOTween/DOTween.cs +++ b/_DOTween.Assembly/DOTween/DOTween.cs @@ -32,7 +32,7 @@ namespace DG.Tweening public class DOTween { /// DOTween's version - public static readonly string Version = "1.2.001"; // Last version before modules: 1.1.755 + public static readonly string Version = "1.2.002"; // Last version before modules: 1.1.755 /////////////////////////////////////////////// // Options //////////////////////////////////// diff --git a/_DOTween.Assembly/DOTweenUpgradeManager/Autorun.cs b/_DOTween.Assembly/DOTweenUpgradeManager/Autorun.cs index 5366a82..48df884 100644 --- a/_DOTween.Assembly/DOTweenUpgradeManager/Autorun.cs +++ b/_DOTween.Assembly/DOTweenUpgradeManager/Autorun.cs @@ -3,27 +3,47 @@ // License Copyright (c) Daniele Giardini // This work is subject to the terms at http://dotween.demigiant.com/license.php +using System; using UnityEditor; using UnityEditor.Callbacks; using UnityEngine; +using DateTime = System.DateTime; namespace DG.DOTweenUpgradeManager { /// - /// This class and its whole library are deleted the first time DOTween's setup is run after an upgrade (or after a new install) + /// This class and its whole library are deleted the first time DOTween's setup is run after an upgrade (or after a new install). + /// NOTE: DidReloadScripts doesn't work on first install so it's useless, InitializeOnLoad is the only way /// + [InitializeOnLoad] static class Autorun { - [DidReloadScripts] - static void DidReloadScripts() + static readonly string _Id = "DOTweenUpgradeManager"; + + static Autorun() { - EditorUtility.DisplayDialog("DOTween", - "New version of DOTween imported: SETUP REQUIRED." + - "\n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to set it up and to add/remove Modules." + - "\n\nIMPORTANT: if you were upgrading from a DOTween version older than 1.2.000 you will see lots of errors." + - " Close and reopen your project, then open DOTween's Utility Panel and run the Setup to activate required Modules.", - "Ok" - ); + _Id = Application.dataPath + _Id; + + bool refresh; + DateTime now = DateTime.UtcNow; + DateTime lastTime; + if (!EditorPrefs.HasKey(_Id) || !DateTime.TryParse(EditorPrefs.GetString(_Id), out lastTime)) { + refresh = true; + } else { + refresh = (now - lastTime).TotalSeconds > 60; + } + if (refresh) { + EditorPrefs.SetString(_Id, now.ToString()); + EditorUtility.DisplayDialog("DOTween", + "DOTWEEN SETUP REQUIRED: new version imported." + + "\n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to set it up and add/remove Modules." + + "\n\n::::: IMPORTANT :::::" + + "\nIf you're upgrading from a DOTween version older than 1.2.000 you will see lots of errors." + + "\n1) Close and reopen the project (if you haven't already done so)" + + "\n2) Open DOTween's Utility Panel and run the Setup to activate required Modules", + "Ok" + ); + } } } } \ No newline at end of file