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 microsoft.xna.framework.game.dll)

Syntax

public virtual void Initialize ()

Remarks

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.

Example

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()
{
    base.Initialize();
}
    

See Also

Reference

GameComponent Class
GameComponent Members
Microsoft.Xna.Framework Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP