XNA When to call LoadContent
Posted
by
Peteyslatts
on Game Development
See other posts from Game Development
or by Peteyslatts
Published on 2012-12-15T18:31:22Z
Indexed on
2012/12/15
23:21 UTC
Read the original article
Hit count: 239
XNA
|xna-content-pipeline
I have an enum in my game that denotes the game state ie MainMenu, InGame, GameOver, Exit and I was wondering if it would be advisable to add a new one in for PrepGame - in which the game creates viewports for however many players there are, creates the battlefield etc.
I feel like this is a good idea except for one thing: should I make a call back to LoadContent() in this state? I could just put a switch statement in the LoadContent for my currentGameState. If it equals PrepGame load things like the skybox, ship models, texures, HUD graphics etc. Or is it a good idea to create an Asset Manager class in the first call to LoadContent() and load everything then.
I feel like both approaches have different benefits: faster, but more load times vs slower initial load time, but then all my objects are referencing the same variables so I only have to load each on once.
Any help is greatly appreciated.
Thanks, Peter
© Game Development or respective owner