Load order in XNA?
- by marc wellman
I am wondering whether the is a mechanism to manually control the call-order of
void Game.LoadContent()
as it is the case with
void Game.Draw(GameTime gt)
by setting
int DrawableGameComponent.DrawOrder
?
except the order that results from adding components to the Game.Components container and
maybe there exists something similar with Game.Update(GameTime gt) ?
UPDATE
To exemplify my issue consider you have several game components which do depends to each other regarding their instantiation. All are inherited from DrawableGameComponent.
Now suppose that in one of these components you are loading a Model from the games content pipeline and add it to some static container in order to provide access to it for other game components.
public override LoadContent() {
// ...
Model m = _contentManager.Load<Model>(@"content/myModel");
// GameComponents is a static class with an accessible list where game components reside.
GameComponents.AddCompnent(m);
// ...
}
Now it's easy to imagine that this components load method has to precede other game components that do want to access the model m in their own load method.