Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Responsive Layout (DPI?)

Discussion in '2D' started by MarkusU, Sep 21, 2015.

  1. MarkusU

    MarkusU

    Joined:
    Aug 22, 2015
    Posts:
    22
    Hello,

    I am working just a few weeks with Unity, but in the tutorials I watched the developers just code for one resolution or device. Currently I work on webapplications, apps and backend technologies, there is the state of art to use responsive layouts to support different devices for example iPad, Android Phones und Desktops.

    I found no information about this critical part of development, just some custom code where an developer gets the device resolution (would DPI not be the better way?) and check some switch/code operations to change sprites etc.

    Is that best-practise? Maybe I am spoiled from android development, but Unity is a cross platform development tool and I thought that is one big part of cross development. Is there a unified solution from unity to resolve the problem? I think any developer will need for his project.

    Thanks for help!

    Regards,

    Markus
     
  2. alijib

    alijib

    Joined:
    Nov 14, 2014
    Posts:
    17
  3. dMartinezAyuso

    dMartinezAyuso

    Joined:
    Apr 9, 2015
    Posts:
    2
    Hi,Markus.
    I have the same problem as you, I've tried a thousand things like scripts that resize all sprites (then had problems with events and collisions), put vertical or horizontal bars (I did not like the end result). I also know that if that is possible with Unity, as for example Megasphere game scale full screen on all resolutions.

    My solution I've given (if it is not correct, but it works!) is treating everything as if UI was, as the Unity Canvas component if you scale it all perfectly. I not whether it is right as always read articles to scale to full screen UI, but not the entire game.

    For example, I put sprites like UI Image and then add your colliders, scripts, particles, etc, etc. With well-configured anchors I've managed to do.

    I have also read that it is a known issue of Unity whole topic. I guess with the update that will be in December solve this.

    I hope you have been helpful and sorry for my poor English.