I'm just curious if it actually loads the asset into memory every time it's called or if it looks it up, finds if it's loaded and if it isn't loaded it loads it once and just keeps references so the second time it's called it just grabs a reference to it?
Asked
Active
Viewed 3,597 times
1 Answers
2
It keeps track of what has already been loaded, and simply returns a reference to the same object if it has been loaded before (this is per-ContentManager). This applies to all content, not just textures.
The upshot is that you can just call Load
whenever you need some Content, without having to think about duplication. The other upshot is that you should never Dispose
of content loaded from ContentManager (use ContentManager.Unload
instead).
If you want more detail, take a look at this question and answer.

Community
- 1
- 1

Andrew Russell
- 26,924
- 7
- 58
- 104
-
Ah thanks, that was the answer I was hoping for. I used to use my own content manager which worked in this way so I just assumed that was the case for XNA too. Then I panicked because I realized it was just an assumption and I didn't know for sure if it kept references or if it loaded duplicate assets.. – meds Nov 22 '10 at 06:49