Load order in XNA?
Posted
by
marc wellman
on Game Development
See other posts from Game Development
or by marc wellman
Published on 2012-11-02T10:51:53Z
Indexed on
2012/11/02
17:34 UTC
Read the original article
Hit count: 355
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.
© Game Development or respective owner