Search Unity

Unity 3.4 Portrait-Landscape Autorotate on iOS looks bizarre

Discussion in 'iOS and tvOS' started by goodhustle, Aug 2, 2011.

  1. goodhustle

    goodhustle

    Joined:
    Jun 4, 2009
    Posts:
    310
    Just looking for some confirmation that I'm not doing something wrong here.

    I'm testing out the new Screen autorotate setting, and it looks like when it animates a rotation between landscape and portrait, it's doing a render of the screen to texture and then squishing/stretching to animate a smooth rotation. Then when it gets to the proper rotation, there's a flash to black, and then the "new" FOV comes into play. Only animating between landscape modes looks fine.

    I realize that it would require a lot more configuration to smoothly animate FOV's, and perhaps just handling Landscape OR Portrait, and not both, covers the vast majority of games, but it would be nice to hear whether this is a known issue, if it affects anyone else, and/or if there are any improvements planned down the line.

    ... and while I'm at it, creating OnScreenWillRotateFromTo/OnScreenDidRotateFromTo (or similar events) for us to script modifications to UIs, etc. would be very helpful.
     
  2. Le_nain

    Le_nain

    Joined:
    Jun 20, 2011
    Posts:
    47
    Confirmed.
    I was so excited seeing that they implemented something about smooth rotations, but then I ended up exactly with your observations. Too bad, I'll have to pass on that smooth rotation again :(
     
  3. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    submit a bug report with an example so it will be fixed in the future
     
    Last edited: Aug 3, 2011
  4. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I would love to see only landscape or portrait covered by this feature. It doesn't make senes to take an OpenGL view and try to change it from landscape to portrait or vice versa smoothly. That kind of stuff is best handled for non-game apps with UIKit.
     
  5. thomasw

    thomasw

    Joined:
    Jun 20, 2011
    Posts:
    5
    It's even worse for me. On iPhone 3GS I see the behavior that getluky describes, but on iPhone 4 it crashes after rotating. (It rotates, renders at the new orientation, then crashes.)
     
  6. goodhustle

    goodhustle

    Joined:
    Jun 4, 2009
    Posts:
    310
    Bug report 414546 filed. ThomasW, you may want to file another bug for a crash.
     
  7. thomasw

    thomasw

    Joined:
    Jun 20, 2011
    Posts:
    5
    Wrote up my crash as 415322
     
  8. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    we have checkbox just for that: use os animated autorotation. If you uncheck it you will get non-animated immediate rotation without squeeze. As for animated rotation you do understand (as was hinted bu original poster) that it is impossible for us to properly handle it.
     
  9. Whimsical

    Whimsical

    Joined:
    Mar 29, 2008
    Posts:
    155
    Oh how I loath to hear people say that something is "impossible", especially when they talk about software.

    Nothing is impossible. Ever. First law of proper software design.

    Here's an idea on how to do it: Make not one but two render-to-textures, one with the start and one with the final screen. And then blend them over while rotating the viewport. Probably not a perfect solution, but that would look a whole lot better than only skewing and rotating a texture around and then cutting it off abruptly.

    So please do what your boss is paying you for: Make it work. Be creative. Make Unity something to be proud of, the best product on the market that is years ahead of its competition - and not just another tool that causes a lot more manual labor for the end user than it is supposed to. Take a look into your business plan. It probably tells that Unity should be exactly that, nothing less. At least it probably did until a year or two ago. Now the business plan probably tells you that Unity is just supposed to be a low-cost channel to sell mostly stupid assets to thousands of hobbyists that are aspiring to create the next big MMORPG or FPS. In that case, Unity does its job just fine.
     
  10. goodhustle

    goodhustle

    Joined:
    Jun 4, 2009
    Posts:
    310
    @Whimsical, that's a pretty unfair comment.

    He did not say it was impossible, he said it's impossible to properly handle it. And by proper, that most likely means handling the general case in a solid way requires a lot of very poor compromises on the configuration front. It's possible to handle animated autorotation yourself using your own camera rotations. Look up OrientationControl if you need help. The animated autorotation feature is a nice checkbox convenience provided in 3.4 for most people who are just focusing on Landscape or Portrait.

    I am sure we can think of a few ways how we could make it work for our own use case, but their job is to make a general platform that works for as many use cases as possible. In your example, how would you even know what the "end" screen buffer would contain without providing full configurability on all cameras in the scene pre- and post- rotation for each transition?
     
  11. Whimsical

    Whimsical

    Joined:
    Mar 29, 2008
    Posts:
    155
    @getluky, please allow me to bring both our views to the basic point, and please correct me if I'm wrong:
    Your opinion on this: We should be grateful for what we are provided with. Things are difficult to handle in a one-size-fits-all kinda situation.
    My opinion on this: If UT's ambition as a company is to serve the market with the most sophisticated piece of software that is humanly possible (which they will have to if they want to survive the coming two or three years), the staff has to go the extra mile to make it happen.

    And for two years now I just don't see them doing that any more. (The fate of Quest3D ("Quest what?" Exactly!) comes to mind.)

    I understand your point that things can get hairy when you have to handle multiple platforms with the same tool. But then again: Don't try to forcefully handle many platforms if the whole product suffers. That leaves all parties in a losing position. Most of the time, less is actually more!
     
  12. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    Guys, i just don't get the point of arguing

    There are no render textures involved unless you ask for it
    Readback from FB on TBDR architecture will kill the framerate
    blend textures with different aspects? sounds not too sane
    blend while rotating viewport? once again - it is your camera and your viewport
    while rotating? that means we need to fully override ios animation and do it *step by step* ourselves - not cool

    anyway - you can uncheck "Use Animated Autorotation" and have awesome orientation change

    that was fixed but i'm sorry to say i don't know did it go into 3.4.1 or not [most likely not]
     
  13. prime31

    prime31

    Joined:
    Oct 9, 2008
    Posts:
    6,426
    I'm with Lucky on this one. That is a very hard problem to solve that really doesn't warrant the time IMO. How many games out there support both landscape and portrait? I can't think of any off the top of my head let alone one made with Unity. For those that do need to support all 4 orientations is it really necessary to animate it? Why not just switch orientations at the appropriate time?
     
  14. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,624
    Just in case - i repeat myself here - if you uncheck "Use Animated Autorotation" you will have that behaviour without any code: it just hook up ios orientation change notification and re-orient without animation (immediately)
     
  15. _ex_

    _ex_

    Joined:
    May 23, 2011
    Posts:
    98
    I didn't see any reference to this in 3.4.1 release notes and I'm using 3.4
    I see this working in my ipod4, ipad2, ipod3gs and ipad. The animation runs smooth, everything works... thumbs up! :D
    Sadly I don't have an iphone4 to test this, it must be the same as the ipod4, isn't it, isn't it?
    Please guys confirm this is not crashing becasue I want to use autorotation in iOS.

    Android I think is not fully tested, I see weird results with my 2 test devices:

    - android 2.3 (nexus S): I set autorotation only between landscape modes, the game autorotates fine (no animation, but there is no option for that in Unity so its Ok), however when a video is playing the autorotation goes even between portrait modes, it is not fun!
    - android 2,2 (milestone) autorotation doesn't work at all in my game, but my UI system starts messed if I rotate the phone when my game is loading (something like the screen wanted to rotate but it didn't rotate at the end)

    Is this fixed in 3.4.1?

    If not it would be cool to have a mode when Unity detects if the underlying device gracefully supports autorotation and if it doesn't do, the autorotation is totally disabled, this way I can support autorotation in newer devices but maintain compatibility with older devices.

    Thanks!
     
    Last edited: Oct 12, 2011
  16. _ex_

    _ex_

    Joined:
    May 23, 2011
    Posts:
    98
    Nothing is perfect. First law of Murphy :D
     
  17. andy@extlabs

    andy@extlabs

    Joined:
    Oct 8, 2011
    Posts:
    49
    what a ridiculous demand. thank god the devs are not at your beck and call. please dont speak for "proper software design" again, considering this issue isn't even in the problem domain.
     
  18. _ex_

    _ex_

    Joined:
    May 23, 2011
    Posts:
    98
    Can we have different settings for iOs and Android?
    With 3.4 they are the same but my tests point that this feature isn't working with some Android devices.
     
  19. Rom-

    Rom-

    Joined:
    Nov 26, 2008
    Posts:
    90
    For that matter, can we have per-scene controls for auto-rotation? At least a scripting interface to enable/disable it. For instance, I would like to have one scene that plays a video that auto-rotates, but not the rest of the game.
     
  20. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Short update on discussed issues:
    - autorotation crash on iOS 5.0 was fixed with Unity 3.4.2
    - if you want to support all 4 orientations then probably the best way is to do it without animation. As @Alexey pointed out you can do this in Editor Player settings or via script:
    Code (csharp):
    1. PlayerSettings.useOSAutorotation = false; // Disables rotation animation
    - also you can control autorotation from the script in the same way as from Player settings in Editor:
    Code (csharp):
    1.  
    2. // Enable autorotation between both Landscape orientations
    3. Screen.orientation = ScreenOrientation.AutoRotation;
    4. Screen.autorotateToLandscapeLeft = true;
    5. Screen.autorotateToLandscapeRight = true;
    6. Screen.autorotateToPortrait = false;
    7. Screen.autorotateToPortraitUpsideDown = false;
    8.  
    Code (csharp):
    1.  
    2. // To disable autorotation, just set specific orientation from the code
    3. Screen.orientation = ScreenOrientation.LandscapeLeft;
    4.  
     
  21. tonyd

    tonyd

    Joined:
    Jun 2, 2009
    Posts:
    1,224
    Thanks for the update.

    Has anyone else reported a possible issue with iOS 5 and the Portrait orientation?

    My latest game does indeed support all orientations, but I'm having issues with Portrait orientation thinking it's Landscape.

    Basically, I have auto-rotation turned on only to properly orientate the Unity Splash screen, and then turn it off in code. At that point it does an orientation check and manually sets the correct orientation. This is working for all 4 orientations except portrait.

    Now, it's possible there is a problem with my code, but the hell if I can find it.
     
  22. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    We are not aware about such problem. If you have a repro case please report a bug (Help -> Report a Bug) with case attached to it.
    Thanks!
     
  23. tonyd

    tonyd

    Joined:
    Jun 2, 2009
    Posts:
    1,224
    I'll test on 3.4.2 first, and if the problem still exists I'll file a bug report.
     
  24. francksitbon

    francksitbon

    Joined:
    Jan 22, 2010
    Posts:
    268
    Hi,
    I have an Issue with the iOS Alerts ("rate our app" from Etcetera )
    If I turn the device during the alert, the alert will turn once.
    If I turn again the device, the alert won't turn anymore

    If I receive a push alert, and turn the device, the alert never turns.

    I don't have any code, all in player settings:
    animated autorotation, portrait and portraitupsideDown are checked.
     
  25. francksitbon

    francksitbon

    Joined:
    Jan 22, 2010
    Posts:
    268
    seems also that the autorotation animation happens also once.
     
  26. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Animation is better than jerky jumps; that's part of what defined iOS. I just discovered this problem and thread. I love flipping between the two orientation pairs that match, with animation, but this isn't usable. Apple does it right; watch the keyboard resize between orientations. That's what I want. I can't "see that fast" – what happens while rotation is happening? The button text is the same size in both orientations, but the button widths are not.
     
  27. goodhustle

    goodhustle

    Joined:
    Jun 4, 2009
    Posts:
    310
    Jessy, you might try out OrientationControl on the Asset Store. There is still a lot of messing around to get it to "work right" if you really want the animations, but it's is an option if you're willing to just handle it yourself. I can't imagine Unity putting enough options in the editor to make this work in a configurable manner in the general case. You need to define FOV start and end, and presuming you have different layouts you must also hack camera or element repositioning together.
     
  28. pweeks

    pweeks

    Joined:
    Mar 29, 2011
    Posts:
    104
    might not be the right thread...but i've got a problem with Unity displaying portrait when only landscape is allowed...obviously doesnt work. have to force quit the app and then relaunch and hope for it not to happen. doesnt seem to happen on ipad build...can't see what the difference would be
     
  29. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I'm having this exact same problem on the iPhone 4s, while on the iPad3/2 there is no issue. Did anyone figure out how to solve/fix this issue?
     
  30. goodhustle

    goodhustle

    Joined:
    Jun 4, 2009
    Posts:
    310
  31. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204