Can't set Window Title in Game1 constructor

I’ve noticed a strange inconsistency between WindowsDX and DesktopGL builds of my project. In the DirectX version, I can call Window.Title = "Hello World" in the constructor of Game1, and “Hello World” will appear in the window title bar as expected. But in the DesktopGL version, the window title will be the name of the project, regardless of what I set it to in the constructor. But for some reason it works if I set Window.Title inside the Initialize() method.

My code couldn’t be contributing to the problem, since I tested this with just the basic templates – nothing added except this line in the constructor. Is this a bug in MonoGame or is there a better explanation for this behavior? Thanks!

1 Like

This is a known bug (I don’t think an issue is logged, but I knew about it). I’ll set up a pull request to fix it. The title will only stick after the window is created in DesktopGL, so your workaround of setting the title in Initialize is a good one :slight_smile:

1 Like

Okay, great! Thanks for the quick response. :slight_smile:

2 Likes

Override Initialize method in your Game class and set stuff there.

1 Like