private static void BuildAssets()
        {
            EditorUtility.ClearConsole();

            if (UnityEditorUtility.scriptCompilationFailed)
            {
                return;
            }

            try
            {
                var result = MetadataAssetUtility.GenerateMetadataEntityScripts();
                EditorPrefs.SetBool(ScriptsGeneratedPrefKey, result);

                if (result)
                {
                    UnityEditorUtility.DisplayProgressBar("Hold on...", "Compiling metadata entity scripts...", 0f);
                }
                else
                {
                    if (UnityEditorUtility.DisplayDialog("Error", "Failed to generate metadata entity scripts!", "OK"))
                    {
                        UnityEditorUtility.ClearProgressBar();
                    }
                }
            }
            catch (System.Exception e)
            {
                Debug.LogException(e);
            }
        }
示例#2
0
        /// <summary>
        /// Prepares the configuration metadata generation.
        /// </summary>
        private static void PrepareConfigMetadataGeneration()
        {
            // Clear all logs.
            EditorUtility.ClearConsole();

            // Create database files directory.
            if (!Directory.Exists(databaseFilesPath))
            {
                Directory.CreateDirectory(databaseFilesPath);
            }

            // Clear database.
            EditorUtility.DeleteAllAssetsInDirectory(databaseFilesPath);

            // Delete old script files.
            EditorUtility.DeleteAllAssetsInDirectory(scriptFilesPath);
        }