public static void UpdateLinkedAssets(Preset preset) { var autoPresetConfigList = AssetDatabaseTools.GetAllAutoPresetConfigs(); const string UPDATE_ASSETS_TITLE = "Updating AutoPresetConfigs"; EditorUtility.DisplayProgressBar(UPDATE_ASSETS_TITLE, String.Empty, 0f); for (var i = 0; i < autoPresetConfigList.Count; i++) { var progress = Mathf.Clamp01((float)i / autoPresetConfigList.Count); EditorUtility.DisplayProgressBar(UPDATE_ASSETS_TITLE, String.Empty, progress); var autoPresetConfig = autoPresetConfigList[i]; if (autoPresetConfig.Preset != preset) { continue; } var msg = string.Format("Importing assets for [{0}]", autoPresetConfig.name); EditorUtility.DisplayProgressBar(UPDATE_ASSETS_TITLE, msg, progress); var assetPath = AssetDatabase.GetAssetPath(autoPresetConfig); var parentPath = AssetDatabaseTools.GetAssetParentFolderPath(assetPath); AssetDatabaseTools.ReimportAllAssets(parentPath, autoPresetConfig); } EditorUtility.ClearProgressBar(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); GUILayout.Space(5); GUILayout.Label(ACTIONS_TITLE_TEXT, EditorStyles.boldLabel); var config = (AutoPresetConfig)target; if (GUILayout.Button(REIMPORT_BUTTON_TEXT)) { var assetPath = AssetDatabase.GetAssetPath(config); var parentPath = AssetDatabaseTools.GetAssetParentFolderPath(assetPath); AssetDatabaseTools.ReimportAllAssets(parentPath, config); } }