Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question UI Canvas to phone and tablet!?

Discussion in 'UGUI & TextMesh Pro' started by Giannigiardinelli, Dec 24, 2022.

  1. Giannigiardinelli

    Giannigiardinelli

    Joined:
    May 8, 2014
    Posts:
    179
    Hi everyone

    Here I am again posting a new question or at least a question I had already asked. But with no solution solved...
    Today, given that the Unity3D platform, to evolve, maybe someone will be able to help me.
    This is one of the only things I still can't understand after several years of practicing with Unity3D. This is how interfaces work and resolution!

    My question is simple, after creating an interface Ui with "Canvas", at the right size in the "Game" unit window, for example two joysticks on each side of the screen, a menu button at the top left of the screen, a score at the top right of the screen, then information window interactions are displayed in the center of the screen when the player moves in the game. So far all are displayed correctly!

    My question is why when I test my game, on two different devices. That is to say, when I "build run" the game on a Samsung galaxy phone, it is different from that of the "Game" window of unity and why when I "build" it on a Samsung Tab A7 tablet my interface is different from that of the phone and also that of the "Game" window of unity!?

    It makes me uncomfortable that I can't understand how displays work with Unity! No matter how hard I try to learn, I can't! I modify according to the available settings, but it does not work!

    I would like my interface that is in the unity "game" or "simulator" window to be the same on devices when I "build run" my game

    Is there someone who can help me understand how it works so that the interfaces don't change when I test on different devices? I'm not going to buy all the devices, existing on the market, to be able to test the interface of my game?

    Thank you in advance for your time and answer!
     
    Last edited: Dec 24, 2022
  2. Giannigiardinelli

    Giannigiardinelli

    Joined:
    May 8, 2014
    Posts:
    179
    Further to the response of @nabeelasad2007 >>>
    1 My Canvas PC

    1FenetreGame1920x1080.png


    Then...

    2 My Canvas Scalar

    2MonCanvasScalar.png


    Anchor Points in the Rect Transform

    8Avant.png

    5 > 8 : So I used "Anchors presets" for the top interface. I then also select "Shift: Also set pivot" and "Alt: Also set position" My "interfaceGame" displays in "Rect Transform" 0,0,0...

    But :

    I reposition "InterfaceGame" not in relation to the "Game" window (1920x1080Landscape) of unity and then test on my phone and my tablet...


    Phone :

    ResultaTelephone.png


    Problem still present


    Tablet :


    TablettePhotoGame.png

    On Unity the interface is well placed. But if I test on my phone the ribbon where its attachment the butons, it's shrunken ...
    If I test my game on a Samsung A7 tablet we can see that my ribbon is much more stretched and that the buttons are no longer framed. Then we can see that the ribbon and lower, since we can see a space between the screen and the interface. I made arrows to make you visualize the screen better.
    If the problem is just in the canvas, I should do some tests, but the problem is that I would never be sure if my game is well framed compared to all the screens of my next users.
    However, I have followed your explanations...

    Thank you in advance for your feedback
     
  3. Giannigiardinelli

    Giannigiardinelli

    Joined:
    May 8, 2014
    Posts:
    179
    No one can help me please ?
     
  4. xpath

    xpath

    Joined:
    Dec 3, 2018
    Posts:
    20
    Hey, I have a similar problem.
    The only solution I could find by testing (I'm not sure if it counts as a solution) is to check if the device is a tablet code, and if it is a tablet, set the match value to around .75.
    My search for a real solution continues.