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.

Discussion How to make a mobile 2d game appear the same in multiple screen sizes or all screen sizes?

Discussion in '2D' started by usninja, Aug 8, 2023.

  1. usninja

    usninja

    Joined:
    Jan 29, 2017
    Posts:
    3
    This could be a beginner question but I am struggling since I started with unity. I am curious on how you guys approach this situation and how do big game companies do also. Thx!
     
  2. karderos

    karderos

    Joined:
    Mar 28, 2023
    Posts:
    376
    it never look the same since all phones have different size

    you can force it with black bars like you do with movies

    but big companies make it dynamic, they use anchors and let it scale depending on the size of the phone, so that it looks good on all size, even if its different
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    37,238
    ^ ^ ^ This... this bigtime.

    And here's how to do it:

    Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:

    https://forum.unity.com/threads/inc...size-between-two-people.1130146/#post-7261747

    https://forum.unity.com/threads/game-ui-button-size-problem.1142650/#post-7337383

    Usually you need to choose a suitable ScaleMode and MatchMode in the Canvas Scaler and stick with it 100%. Generally if you change those settings you will often need to redo your UI entirely.

    I also use this
    CanvasScalerOrientationDriver
    utility to make sharing UI for Landscape / Portrait easier. Read what it does carefully.

    https://gist.github.com/kurtdekker/8802b1b6c708637398f8c9167641efd3
     
  4. usninja

    usninja

    Joined:
    Jan 29, 2017
    Posts:
    3


    Thanks for your answer, but im not talking about UI, I am talking about actual sprites in the game, player, background, enemies and so on.
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    37,238