Search Unity

Question Canvas elements are not fully visible on the screen

Discussion in 'Android' started by NiklasB08, Oct 1, 2022.

  1. NiklasB08

    NiklasB08

    Joined:
    Jan 28, 2022
    Posts:
    11
    Hello,
    I am programming a game that has many UI elements in it. Therefore I made a sort with empty Game Objects, these have the UI elements as child objects.
    On the computer you can see all the UI elements, but on the Android phone the UI elements that are on the edge of the canvas are not visible at all or only partially visible.

    Thanks a lot for your help.
     
  2. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    Please post screenshots from both on PC and Android, so we can see what's happening.
     
  3. NiklasB08

    NiklasB08

    Joined:
    Jan 28, 2022
    Posts:
    11
    Here are the two screenshots.
     

    Attached Files:

  4. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    It's most probably happening because of the settings in the "Canvas Scaler" component of the Canvas, see below:

    Screenshot 2022-10-08 at 12.18.04 PM.png

    To get a better idea, change the aspect ratio of the game in the editor and you will see, then change to Canvas Scaler settings to find which one works for you.
     
  5. NiklasB08

    NiklasB08

    Joined:
    Jan 28, 2022
    Posts:
    11
    Hello Sailendu,

    thank you very much for the answer. I followed your instructions and it looks fine on my smartphone now, but now there are problems with the view on other devices.

    Does unity not provide a way to automatically set the canvas to the correct size for all devices?
     
  6. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    Please post a screenshot of how the problem looks on other devices, then I can understand.
     
  7. NiklasB08

    NiklasB08

    Joined:
    Jan 28, 2022
    Posts:
    11
    Here are the four screenshots.
     

    Attached Files:

  8. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    254
    Try setting the "Screen Match Mode" to "Expand", it should work better.
     
  9. NiklasB08

    NiklasB08

    Joined:
    Jan 28, 2022
    Posts:
    11
    Thanks Sailendu, that was the solution.