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. Dismiss Notice

Get UI To scale with Android screen

Discussion in 'UGUI & TextMesh Pro' started by SaamBell, Apr 24, 2015.

  1. SaamBell

    SaamBell

    Joined:
    Mar 28, 2014
    Posts:
    128
    Hey! so I've made a small & simple cookie clicker like game in the Newest version of unity. Whilst it looks good playing on my laptop i need the UI to also scale and look appropriate on my Android device too (Samsung Galaxy S5). What do i need to do in order to achieve this??

    Cookie1.png

    x1080x1920y are the dimensions of my Samsung Galaxy screen and as shown in the window above this is how my game looks when i try to play it. And it's way to small to really be able to function like it should.

    Cookie 2.png

    I'm new with the new Unity/UI features and need help on how to make the buttons scale with the screen size or make them bigger to fit better on my phone screen.
     
    guetta18 likes this.
  2. Ramcat

    Ramcat

    Joined:
    Aug 16, 2014
    Posts:
    95
    Well, it looks like you have a good start. You have a Canvas Scaler, although I might not set the reference resolution to your target resolution (or I'd make another resolution to test on, so you can see it scale). In the game tab (just below the text "Game") you can create different resolutions to view your game in. Otherwise all the elements you create should scale if you've set the anchors correctly.

    Looks like you need to watch some of the tutorials and play around with different scaling until you get the hang of it.
     
  3. merlock18

    merlock18

    Joined:
    Dec 30, 2013
    Posts:
    28

    (This is not my video but it helped me)
     
    guetta18 likes this.
  4. sefiroths

    sefiroths

    Joined:
    Dec 13, 2014
    Posts:
    24
    Hi, I'm using unity 2017.2.f3
    I have a canvas with canvas scaler and image with anchor as in image.
    When I scale the canvas in unity editor game tab or in real device ios works perfectly.
    When I scale the canvas in android device (I have a galaxy tab) the image is not scaling...

    If I use screen space overlay it scales, but I had line rendere that needs screen space camera that is not displayed that manner

    Am I missing something?
    how to debug this issue?
    thanks
     

    Attached Files:

    Last edited: Dec 30, 2017
  5. Cipher123

    Cipher123

    Joined:
    Jan 16, 2018
    Posts:
    1
    guetta18 likes this.
  6. rayD8

    rayD8

    Joined:
    Mar 7, 2018
    Posts:
    32
    That link describes "how-to".
    I am having the same problem. Works on other OSes, but not Android.

    It seems the only few posts I could find - people mention they are using a Galaxy Tab... same here.
     
  7. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,076
    I also had trouble getting the canvas scaler working properly. So I created an asset to solve these problems.
    So you might find Better UI also useful for your project :)
     
    Propagant likes this.
  8. guetta18

    guetta18

    Joined:
    Jul 24, 2018
    Posts:
    19
    i think that when you using correctly the anchors everything works great.
     
  9. falkenbrew

    falkenbrew

    Joined:
    Apr 21, 2020
    Posts:
    146
    just in case anyone finds this post while trying to fix scaling issues on Android. Using "Screen-Space - Camera" did not scale correctly, switching to "Screen-Space - Overlay" fixed the problem.