using UnityEditor; using UnityEngine; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace P4Connect { /// /// This class hooks onto the Asset Save/Delete/Move process and makes sure that /// Perforce is updated accordingly. It uses the perforce connection class /// (which internally uses Config to retrieve the connection settings) /// to open a connection to the server and add the required changes (add/checkout/delete/move). /// public class AssetPostProcessor : UnityEditor.AssetPostprocessor { public static void OnPostprocessAllAssets ( String [] aImportedAssets, String [] aDeletedAssets, String [] aMovedAssets, String [] aMovedFromAssetPaths) { #if DEBUG Logger.p4log("#### OnPostprocessAllAssets"); Logger.p4logArray(" create: ", aImportedAssets); Logger.p4logArray(" delete: ", aDeletedAssets); Logger.p4logArray(" Move: ", aMovedAssets); Logger.p4logArray(" MoveTo: ", aMovedFromAssetPaths); #endif if (aImportedAssets.Length > 0) { Engine.CreateAssets(aImportedAssets); } if (aDeletedAssets.Length > 0) { Engine.DeleteAssets(aDeletedAssets); } if (aMovedAssets.Length > 0) { Engine.MoveAssets(aMovedFromAssetPaths, aMovedAssets); } #if DEBUG Logger.p4log("#### OnPostprocessAllAssets Complete"); #endif } } }