As per title. Screen.height and Screen.width report the dimensions of the Game window in the editor which contains the running game, not the dimensions of the area the game is actually playing in.
This occurs if you use Screen.width/height from an editor script. This makes some sense; however, it presents a problem for me.
The problem is that while running in the editor I want to be able to change values via my custom Inspector and have these changes affect the game. The problem is that when I make a change I need to tell my game to recalculate various things. These things are dependant on the Screen dimensions.
One work around I’ve found has been to make the recalculation method a coroutine which yields immediately when called for one frame and then executes normally the next frame. If I do this when the coroutine executes the Screen dimensions are correct. I assume that after the editor classes have been executed the Screen dimensions get changed to the actual game dimensions for the non-editor behaviours. There are multiple different methods and scenarios that mean creating coroutine versions of all my methods is not a great solution.
Another option I don’t want to use is to poll all the variables of my component in one of its Update methods so that I can invoke the recalculation from there.
Anyone got any other ideas? Is there a way of getting the actual game window dimensions rather than the containing window during OnInspectorGUI?