I have a TextMeshPro GameObject, which I placed within the Canvas. The canvas is set to
Scale with Screen Size and has a reference resolution of 1440x1080.
The TextMeshPro GameObject is anchored to the top-right and its position horizontally is -185 from the anchored point (top-right). And within 1440x1080 resolution it looks like:
But when I make my Display resolution higher or smaller (like for example 1920x1080 as in the image below), the TextMeshPro GameObject goes outside game and ends up in the black area.
I tried changing the position of TextMeshPro GameObject via a script attached to the canvas. I came up with the following formula but it seems wrong.
DisplayResolution.x - (DisplayResolution.X + (ReferenceResolution.X - TextMeshPro.Location.X))
DisplayResolution.X = 1920
ReferenceResolution.X = 1440
TextMeshPro.Location.X = -185
Edit - answer to comments:
Where Starry Backfield is at: