private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { m_resolvers.Clear(); ProcessPaths(importedAssets, m_sources, m_resolvers); ProcessPaths(deletedAssets, m_sources, m_resolvers); ProcessPaths(movedAssets, m_sources, m_resolvers); foreach (string resolverPath in m_resolvers) { if (Utf8JsonResolverAssetEditorUtility.CanGenerateResolver(resolverPath)) { Utf8JsonResolverAssetEditorUtility.GenerateResolver(resolverPath); } } }
protected override bool OnApplyRevertGUI() { SerializedProperty propertyDestinationSource = extraDataSerializedObject.FindProperty("m_info.m_destinationSource"); bool canClear = File.Exists(m_destinationPath) && propertyDestinationSource.objectReferenceValue != null; bool canGenerate = Utf8JsonResolverAssetEditorUtility.CanGenerateResolver(m_importer.assetPath); using (new EditorGUI.DisabledScope(HasModified())) { if (GUILayout.Button("Generate All")) { Utf8JsonResolverAssetEditorUtility.GenerateResolverAll(); } using (new EditorGUI.DisabledScope(m_destinationPathAnotherExist || !canGenerate)) { if (GUILayout.Button("Generate")) { Utf8JsonResolverAssetEditorUtility.GenerateResolver(m_importer.assetPath); } } using (new EditorGUI.DisabledScope(!canClear || !canGenerate)) { if (GUILayout.Button("Clear")) { if (EditorUtility.DisplayDialog("Delete Utf8Json Generated Script?", $"{m_destinationPath}\nYou cannot undo this action.", "Delete", "Cancel")) { Utf8JsonResolverAssetEditorUtility.ClearResolver(m_importer.assetPath); } } } } return(base.OnApplyRevertGUI()); }