Yes, you can add (Drawable
)GameComponent
s at any time. When you add them before Game.Initialize
(eg: in your game constructor), they will have their Initialize
method called when Game.Initialize
is called.
If you add them after Initialize
is called on your game class, then they will have their Initialize
method called when they are added to the Game.Components
collection.
Note that the upshot of this is that there is a small window in your game class's Initialize
method, in between you calling base.Initialize()
and returning, where game components will not be initialized!
Note that Game.Initialize
will call LoadContent
, so adding components in your LoadContent
method also will cause them to not be initialized. Although adding components from a game component Initialize
method will work.
DrawableGameComponent.Initialize
calls DrawableGameComponent.LoadContent
(so don't skip any base
calls in methods that you override
).
You could also add them at the start of your game and then toggle the Enabled
and Visible
properties as required.
Alternately, you could skip the game components system all together. It's basically just a list of objects with virtual Update
and Draw
methods (et cetera). This way you can program things to do exactly what you want.