Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is it possible to detect asset change while running in the unity editor. When I update my model, I see it change but the xml data associated with it does not change. So it would be nice to detect that and reload the xml data while running in the unity editor.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Try OnPostprocessModel (on asset pipeline objects only; does not work on regular scripts) which should be called anytime a model is imported. There are similar hooks for textures and so on as well.

If that doesn't work, or if you want to monitor files that don't correspond to Unity assets, you can set up your own file monitor using FileSystemWatcher to check for any new, modified, or deleted files.

share|improve this answer
    
Since I'm using xml data and a TextAsset, "The correct answer is to create an AssetPostprocessor and override the OnPostprocessAllAssets method." -- answers.unity3d.com/questions/17831/… –  milkplus Oct 14 '12 at 4:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.