//---------------------------------------------------------------------------- static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { AssetDatabase.StartAssetEditing(); foreach (string str in importedAssets) { PKFxAssetCreationUtils.NotifyAssetPostProcess(str); } AssetDatabase.StopAssetEditing(); }
public static void OnAssetChange(ref SAssetChangesDesc assetChange) { PKFxManager.ImportedAssetName = Path.GetFileName(assetChange.m_Path); string relativepath = "Assets" + PKFxSettings.UnityPackFxPath; string assetPath = assetChange.m_Path + ".asset"; LockPackWatcherChanges(); if (assetChange.m_Type == (int)EAssetChangesType.Add) { PKFxAssetCreationUtils.CreatePKFXAsset(assetChange); } else if (assetChange.m_Type == (int)EAssetChangesType.Remove) { AssetDatabase.DeleteAsset(Path.Combine(relativepath, assetPath)); } else if (assetChange.m_Type == (int)EAssetChangesType.Update) { PKFxFxAsset fxAsset = (PKFxFxAsset)AssetDatabase.LoadAssetAtPath(Path.Combine(relativepath, assetPath), typeof(PKFxFxAsset)); if (fxAsset != null) { fxAsset.Clean(); fxAsset.m_Data = File.ReadAllBytes("Temp/PopcornFx/Baked/" + assetChange.m_Path); PKFxAssetCreationUtils.UpdatePKFXAsset(fxAsset, assetChange.m_Path); } else { PKFxAssetCreationUtils.CreatePKFXAsset(assetChange); } } else if (assetChange.m_Type == (int)EAssetChangesType.Rename) { AssetDatabase.RenameAsset(Path.Combine(relativepath, assetChange.m_PathOld + ".asset"), Path.GetFileName(assetChange.m_Path)); PKFxFxAsset fxAsset = (PKFxFxAsset)AssetDatabase.LoadAssetAtPath(Path.Combine(relativepath, assetPath), typeof(PKFxFxAsset)); if (fxAsset != null) { fxAsset.Clean(); fxAsset.m_Data = File.ReadAllBytes("Temp/PopcornFx/Baked/" + assetChange.m_Path); PKFxAssetCreationUtils.UpdateAndRenamePKFXAsset(fxAsset, assetChange.m_PathOld, assetChange.m_Path); } else { PKFxAssetCreationUtils.CreatePKFXAsset(assetChange); } } UnlockPackWatcherChanges(); }