Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Best way to run editor code when an asset is modified?

Discussion in 'Scripting' started by awardell, Dec 1, 2017.

  1. awardell

    awardell

    Joined:
    Feb 5, 2014
    Posts:
    71
    So I want to be able to run a method when a particular asset in my project. Let's say for instance that the asset is an AnimationClip i.e. not something that I can extend and implement OnValidate. I've seen https://docs.unity3d.com/ScriptReference/AssetModificationProcessor.OnWillSaveAssets.html but that isn't exactly what I'm looking for, and seems like an inefficient way of doing things besides. I have a reference to the asset; how do I run code when it's been changed?