If I set the graphics settings in the Initialize
method and then in the Update
method, like so:
protected override void Initialize()
{
graphics.ApplyChanges();
base.Initialize();
}
protected override void Update(GameTime gameTime)
{
graphics.ApplyChanges();
base.Update(gameTime);
}
Everything is fine.
However, when I move the code to my LoadContent
method like so:
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
graphics.ApplyChanges();
}
protected override void Update(GameTime gameTime)
{
graphics.ApplyChanges();
base.Update(gameTime);
}
I get an InvalidOperationException
:
Must call BeginScreenDeviceChange before calling EndScreenDeviceChange
This doesn't make much sense to me, since I'm doing the same thing in both. It was my understanding that the LoadContent
method was simply called after the Initialize
method. What is happening between those calls that messes up the GraphicsDeviceManager
?