- Home /
How do I detect resize event for the game window in the editor?
Testing orthographic camera at various resolutions to test dynamic layouts -- and while I can configure the camera at start, is there any kind of event I can listen to to detect a change in screen resolution so I can modify my layout? Polling the resolution in an update seems like a poor solution.
Answer by reefwirrax · Nov 16, 2013 at 10:19 AM
Screen.width, Screen.height if you check it every half a second, and it will still be very fast, and it will use 1/12000 of your processor power instead of 1/2000th.
Answer by CgShady · Oct 02, 2014 at 06:29 PM
On Mobile, I'm using Screen.orientation to simply detect orientation change. I'm doing it in a Singleton Class with an event, that any other script can subscribe to, so that it's all in one place and doesn't cost too much.
if (Screen.orientation != screenOrientation)
{
if (ScreenOrientationChanged != null)
ScreenOrientationChanged () ;
}
Yet, having an editor callback would be nice.