Share via


Game.Initialize Method

Called after the Game and GraphicsDevice are created, but before LoadContent.

Namespace: Microsoft.Xna.Framework
Assembly: Microsoft.Xna.Framework.Game (in microsoft.xna.framework.game.dll)

Syntax

protected virtual void Initialize ()

Remarks

Override this method to query for any required services, and load any non-graphics resources. Use LoadContent to load graphics resources.

Initialize is called before Draw, so the length of time spent executing code in this method will be experienced by the user as a delay before he or she sees the initial game screen.

Example

In classes that derive from Game, you need to call base.Initialize in 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

Game Class
Game.LoadContent Method
Game Members
Microsoft.Xna.Framework Namespace

Platforms

Xbox 360, Windows 7, Windows Vista, Windows XP