Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Wrong position of TextMeshPro in a 2D Game

Discussion in 'UGUI & TextMesh Pro' started by josericardojr, Aug 16, 2023.

  1. josericardojr

    josericardojr

    Joined:
    Dec 9, 2016
    Posts:
    6
    Hi everyone,

    I'm using the TextMeshPro for displaying the total points of a user. However, I'm getting some sort of error regarding its position.

    When looking in the Game view tab, it looks correct, as the image below.



    However, when looking in the Simulator window (which I believe is the correct one), it looks wrong.



    By the way, the Game view represents the exact position I've used in the editor. Additionally, I'm using the Screen Space Overlay as the render mode for canvas.

    Does anyone can help me to fix this problem?
    Thanks in advance!
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,288
    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
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,129
    The 2D feature set does not include UI. I'll move your post the UGUI/TextMeshPro forum. Please use that for this feature.

    Thanks.