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); } }
private static void OnScriptsReloaded() { var scriptsGenerated = EditorPrefs.GetBool(ScriptsGeneratedPrefKey); if (!scriptsGenerated) { return; } UnityEditorUtility.ClearProgressBar(); EditorPrefs.SetBool(ScriptsGeneratedPrefKey, false); if (!UnityEditorUtility.scriptCompilationFailed) { try { var result = MetadataAssetUtility.CreateMetadataDatabaseFiles(); if (result) { if (UnityEditorUtility.DisplayDialog("Success", "Build success!", "OK")) { UnityEditorUtility.ClearProgressBar(); } } else { if (UnityEditorUtility.DisplayDialog("Error", "Failed to create metadata database files!", "OK")) { UnityEditorUtility.ClearProgressBar(); } } } catch (System.Exception e) { Debug.LogException(e); } } else { if (UnityEditorUtility.DisplayDialog("Error", "Failed to compile metadata entity scripts!", "OK")) { UnityEditorUtility.ClearProgressBar(); } } }