问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/4242741/how-does-xnas-content-loadtexture2d-operate