Futile icon indicating copy to clipboard operation
Futile copied to clipboard

Consistent width / height in FScreen when resizing window in Unity Editor

Open jpsarda opened this issue 11 years ago • 3 comments

When testing in free aspect window in Unity editor, if you resize the window, the width and height are no longer valid as soon as the screen orientation is not the same as the initial orientation.

You can test with the Banana demo, if you start in landscape mode and resize to portrait mode, the game is no longer adapted to the screen size as it has wrong width and height returned by Futile.screen.

I'm aware this is not a critical issue as it only happens in the Editor (unless you can resize dynamically the web player too?), but this modification is handy to check orientation change in real time in the Unity Editor (as long as you test (Futile.screen.width<Futile.screen.height) to decide is your layout is in portrait mode).

jpsarda avatar Oct 10 '13 10:10 jpsarda

Hmm yeah I'll have to think about this... so if I'm reading this right, if the width becomes shorter than the height, then it kinda switches them and it fires an orientation change event, as if it had changed from landscape to portrait? That does make some sense, but I wonder if it might confuse people?

MattRix avatar Oct 22 '13 20:10 MattRix

The fix doesn't send the orientation change event as I was not sure if it's something reserved for an actual orientation change in a true device. But yes that's the idea.

jpsarda avatar Oct 22 '13 21:10 jpsarda

Just to let you know that after testing it on the device, this pull request doesn't work well. So I switched back to your version. But as you might know as I already posted on reddit, FScreen needs to be improved a bit as when the device is changing its orientation there's a dirty on frame transition screen, and HandleResize being called twice.(tested on ipad mini)

jpsarda avatar Oct 31 '13 13:10 jpsarda