• Advertisement
Sign in to follow this  

Loading models and textures outside of LoadContent in XNA

This topic is 2300 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to load assets outside of LoadContent using XNA? I don't want to keep everything in memory at once. I want to be able to load assets on demand. Mainly I'm going to write a C# engine that I want to be able to easily port from XNA, to Mono (for Android and iPhone), and then PSP Vita (because I heard that there's an Indie SDK coming out). Is that even possible? You use Content.Load to load the content, so it could be called from anywhere. But would it cause strange behavior?

Share this post


Link to post
Share on other sites
Advertisement
It really depends on if you plan on loading resources that need the graphics device. You can load anything anywhere with Content.Load but if that resource needs an instance of the GraphicsDevice (like Texture2Ds and Effects) then you'll have to wait until at least base.Initialize has been called.

So in short, yeah you can load content with the content manager outside of LoadContent without causing strange behavior. It really just matters if the dependencies required by that resource are in place. I would only suggest that you keep all of your content loading in a single place so you don't have all of your components coupled to it AND so you aren't loading content all over the place.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement