GameComponent.Initialize Method

Called when the GameComponent needs to be initialized. Override this method to query for required services and load any non-graphics resources.

Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework.Game (in

public virtual void Initialize ()

If this GameComponent has been added to the Game.Components collection, this method will be called automatically if you call base.Initialize in your Game.Initialize method. Note that the template code created by XNA Game Studio will already have this call to base.Initialize in place.

In classes that derive from Game, it is necessary to call base.Initialize in Game.Initialize, which will automatically enumerate through any game components that have been added to Game.Components and call their Initialize methods.

protected override void Initialize()

Xbox 360, Windows 7, Windows Vista, Windows XP

Community Additions