AssetModificationProcessor

AssetModificationProcessor lets you hook into saving of serialized assets and scenes which are edited inside Unity.

Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.

This lets you prevent writing of assets by Unity for integration with VCS solutions like Perforce which require locking of files.

Messages Sent
OnWillCreateAsset

This is called by Unity when it is about to create an asset not imported by the user, eg. ".meta" files

OnWillSaveAssets

This is called by Unity when it is about to write serialized assets or scene files to disk.

OnWillMoveAsset

This is called by Unity when it is about to move an asset on disk.

OnWillDeleteAsset

This is called by Unity when it is about to delete an asset from disk.

IsOpenForEdit

This is called by Unity when inspecting an asset to determine if an editor should be disabled.