How do I dynamically reload content files?

Posted by Kikaimaru on Game Development See other posts from Game Development or by Kikaimaru
Published on 2012-04-11T11:17:46Z Indexed on 2012/04/11 17:42 UTC
Read the original article Hit count: 258

Filed under:
|

Is there a relatively simple way to dynamically reload content files, such as effect files?

I know I can do the following:

  1. Detect change of file
  2. Run content pipeline to rebuild that specific file
  3. Unload ALL content that was loaded
  4. Load all content

And use double references to reference content files.

The problem is with step 3 (and step 2 isn't that nice either). I need to unload everything because if I have model Hero.x which references Model.fx effect, and I change the Model.fx file, I need to reload the Hero.x file which will then call LoadExternalReference on Model.fx.

Has someone managed to make this work without rewriting the whole ContentManager (and every ContentReader) and tracking calls to LoadExternalReference?

© Game Development or respective owner

Related posts about XNA

Related posts about xna-content-pipeline