// Checks if deleted folder contains DOTween Pro and in case removes scripting define symbols
        static AssetDeleteResult OnWillDeleteAsset(string asset, RemoveAssetOptions options)
        {
            // Check if asset is a directory
            string dir = EditorUtils.ADBPathToFullPath(asset);

            if (!Directory.Exists(dir))
            {
                return(AssetDeleteResult.DidNotDelete);
            }
            // Check if directory contains DOTweenPro.dll
            string[] files           = Directory.GetFiles(dir, "DOTween.dll", SearchOption.AllDirectories);
            int      len             = files.Length;
            bool     containsDOTween = false;

            for (int i = 0; i < len; ++i)
            {
                if (!files[i].EndsWith("DOTween.dll"))
                {
                    continue;
                }
                containsDOTween = true;
                break;
            }
            if (!containsDOTween)
            {
                return(AssetDeleteResult.DidNotDelete);
            }
            // DOTween found: remove scripting define symbols
            DOTweenSetupMenuItem.ProEditor_RemoveGlobalDefine("DOTWEEN_TK2D");
            DOTweenSetupMenuItem.ProEditor_RemoveGlobalDefine("DOTWEEN_TMP");
            EditorUtility.DisplayDialog("DOTween Deleted", "DOTween was deleted and any of its scripting define symbols removed.\nThis might show an error depending on your previous setup. If this happens, please close and reopen Unity or reimport DOTween.", "Ok");
            return(AssetDeleteResult.DidNotDelete);
        }
Example #2
0
        /// <summary>
        /// Returns TRUE if the file/directory at the given path exists.
        /// </summary>
        /// <param name="adbPath">Path, relative to Unity's project folder</param>
        /// <returns></returns>
        public static bool AssetExists(string adbPath)
        {
            string fullPath = EditorUtils.ADBPathToFullPath(adbPath);

            if (!File.Exists(fullPath))
            {
                return(Directory.Exists(fullPath));
            }
            return(true);
        }
        // Checks if deleted folder contains DOTween Pro and in case removes scripting define symbols
        static AssetDeleteResult OnWillDeleteAsset(string asset, RemoveAssetOptions options)
        {
            // Check if asset is a directory
            string dir = EditorUtils.ADBPathToFullPath(asset);

            if (!Directory.Exists(dir))
            {
                return(AssetDeleteResult.DidNotDelete);
            }
            // Check if directory contains DOTween.dll
            string[] files           = Directory.GetFiles(dir, "DOTween.dll", SearchOption.AllDirectories);
            int      len             = files.Length;
            bool     containsDOTween = false;

            for (int i = 0; i < len; ++i)
            {
                if (!files[i].EndsWith("DOTween.dll"))
                {
                    continue;
                }
                containsDOTween = true;
                break;
            }
            if (!containsDOTween)
            {
                return(AssetDeleteResult.DidNotDelete);
            }
            Debug.Log("::: DOTween deleted");
            // DOTween is being deleted: deal with it
            // Remove EditorPrefs
            EditorPrefs.DeleteKey(Application.dataPath + DOTweenUtilityWindow.Id);
            EditorPrefs.DeleteKey(Application.dataPath + DOTweenUtilityWindow.IdPro);

//            // The following is not necessary anymore since the Modules update
//            // Remove scripting define symbols
//            DOTweenDefines.RemoveAllDefines();
//            //
//            EditorUtility.DisplayDialog("DOTween Deleted",
//                "DOTween was deleted and all of its scripting define symbols removed." +
//                "\n\nThis might show an error depending on your previous setup." +
//                " If this happens, please close and reopen Unity or reimport DOTween.",
//                "Ok"
//            );
            return(AssetDeleteResult.DidNotDelete);
        }