Search Unity

[RELEASED] AspectSwitcher - Easy adjustments to UI based on device aspect

Discussion in 'Assets and Asset Store' started by Jason-King, Aug 18, 2014.

  1. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    One of the biggest issues when developing for mobile is device fragmentation. With so many different screen resolutions, orientations, and aspect ratios it can be a daunting task to accommodate all those devices. With AspectSwitcher, setting up your user interface or even adding different functionality based on the device's active aspect ratio becomes quite simple.



    This editor extension has been submitted to the Asset Store. I will update once the process has completed.
     
  2. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
  3. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    We are very open to thoughts or specific suggestions on making this a better product. Please watch the video and let us know.
     
  4. Osntear

    Osntear

    Joined:
    Nov 14, 2014
    Posts:
    4
    Hi pro, I just bought aspect switcher, so when I "Set all aspect components", that throw error:
    NullReferenceException: Object reference not set to an instance of an object
    OneLoop.AspectSwitcherDevice.DoSetAllAspectComponents () (at Assets/OneLoop/Editor/AspectSwitcher/AspectSwitcherDevice.cs:34)

    So how can I fix it, thanks !
     
  5. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    each switcher script attached to the game object will be running it's code in the update?
     
  6. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Hi Osntear,

    It looks like there is a bug if you don't have the Window > OneLoop > AspectSwitcher panel opened when you attempt a Set All Aspect Components. I will fix and upload to the store for approval. In the meantime, you can manually open the AspectSwitcher panel (and then close it if you want) to initialize the Editor parts of the system and then everything should all work.

    Cheers,
    Jason
     
  7. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Hi MoHoe,

    No, each AspectDeviceHandler applies the appropriate properties on Awake. I'm currently investigating auto detection of orientation switching to add to AspectSwitcher.

    Cheers,
    Jason
     
  8. Osntear

    Osntear

    Joined:
    Nov 14, 2014
    Posts:
    4
    Thanks for your support :) I got it. Thanks you so much :)
     
  9. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    I've submitted the fix to the asset store yesterday so hopefully that should be up in the next couple of days. After that version goes out, I'll update AspectSwitcher to include a new AspectSwitcherAutoOrientation component that will monitor the screen aspect and update the AspectDeviceHandlers whenever the device's aspect changes.
     
    Osntear likes this.
  10. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Also please rate the extension when you are able to. If there is some feature that is lacking, just let me know. Thanks!
     
    Osntear likes this.
  11. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Version 1.02 is now available in the Asset Store. It contains the fix Set All Aspect Components. Will be submitting version with AspectSwitcherAutoOrientation this week.
     
    Osntear likes this.
  12. Osntear

    Osntear

    Joined:
    Nov 14, 2014
    Posts:
    4
    Hi Jason.King,
    I'm a newbie, so I really thanks for your asset, that's working perfect for me :)
    Could I have a question about FPS in unity2D ?
    So I used Unity Free for build game to IOS, and in Unity Editor FPS our game is 210 FPS, but when I build it to IOS that so delay ( lag ), I can see that slower than Unity Editor. Why ? I guess, 'cause I used Unity Free. So could you please tell me something in this case. Thanks u so much :)
     
  13. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    I would suspect that your PC/MAC that you are using with the Editor is simply quite a bit faster that your iOS device. It should not be a Free vs Pro issue.
     
  14. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Version 1.03 is now available in the Asset Store. It contains the new AspectSwitcherAutoOrientation component. Additionally it is now designated as being compatible with Unity 4.3.0 or higher.
     
  15. rob_stahl

    rob_stahl

    Joined:
    Jan 9, 2015
    Posts:
    1
    Hi there jason, would your AspectSwitcher fix this issue for me? I need 1080p portrait to not compress the game. Thanks!
    Rob
    landscape_vs_portrait_issue.jpg
     
  16. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Yes, you would first add an AspectCamera component to your camera. Then you can specify appropriate camera values per defined aspect ratio - it does not automate the task of calculating the appropriate camera values. But once you have done this then it will automatically assume those new values depending upon the closest aspect that has been defined.
     
  17. Tareqz

    Tareqz

    Joined:
    Oct 18, 2014
    Posts:
    1
    Hi i want to ask you if this work with PC also with different aspect ratio and resolution and if i have gui.button it will be in the same position on different aspect ratio
     
  18. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Hi Tareqz,

    The system works with any device type including the PC. The main default component with the AspectSwitcher system will move elements that have Transform components. Standard gui.button is a runtime object (presented to the player during the OnGui) that doesn't have a Transform component so AspectSwitcher does not work with such objects.

    Cheers,
    Jason
     
  19. blamejane

    blamejane

    Joined:
    Jul 8, 2013
    Posts:
    233
    I'm interested in your asset. I have several menus which utilize scrollrects with content size fitter component, layout group component, etc. for scrolling/infinite menus.

    Does you aspect work well with these components? The problem I'm seeing is my app looks great in iPhone 5, 6 and 6plus, but on the iPad it looks terrible.

    Thanks
     
  20. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Hi Blamejane,

    I believe that it will work. Essentially its an automating system that allow you to change transforms and such of you objects at runtime based on the closest aspect ratio of the device that you are using. If the problem is that you can make it look good for either device aspect A or device aspect B (by moving and adjust the dimensions of your objects), but not both at the same time. Then AspectSwitcher will help make the process of setting up and switching between the various dimensions much easier. We used it for setting up different portrait aspects (phone vs pad) as well as setting up a completely different set of dimensions for landscape. The systems comes with basic transforms and camera handlers. If you need to adjust other internal components based on the aspect then you can create your own handlers for specific features.

    Cheers,
    Jason