Set Resolution by code

hi all!
in my game I need to set the resolution by code reading a config file, so to do this I’ve removed the dialog the option to show the display resolution


and in my code I do this:

Screen.SetResolution(screenWidth, screenHeight, fullScreen);
Screen.fullScreen = fullScreen;

and works fine, but I’ve a behaviour: the first time I select for example 800x600 windowed, the game starts right, 800x600 windowed…
next time I select 1024x768 windowed, the game starts 800x600 when shows the unity loader logo, and after it’s switched to the new resolution…
next time, I leave 1024x768 windowed and the game starts right 1024x768…
is there a way to avoid a screen res change between the default loading screen and the main game??

thanks in advance

Can confirm this is a very strange bug and is happening to me suddenly as well. If I delete the registry key for the built app (windows exe), then it reset to the original resolution but with each time it is loaded, the window grows in increments as the OP states.

This is with Unity 5.6, disabled resolution dialog and using a non-standard resolution of 700 x 100 (auto patcher).

Edit: Fixed by forcing resolution from within player.