thank you. Yeah. I got a cheap 4k monitor. It may be the problem. It still will be nice to check resolution problems because 4k monitors become more and more popular nowadays.
Some solutions to UI scaling problems:
You can anchor UI elements to its borders or get the UNITY AUTOMATIC UI ANCHORING plugin to fix UI problems.
Additionally, Unity has an option to let people choose the resolution before starting. It has to be somewhere in the project management section, so I would prefer the resolution you planned players to use. To test UI scaling, you can change aspect ratios during the play mode in the Unity Editor.
I personally use this C# code to fix my anchors through the code:
rectTransform = objectDragInstance.GetComponent<RectTransform>(); RectTransform parentRectTransform = null; if (rectTransform.transform.parent) parentRectTransform = rectTransform.transform.parent.GetComponent<RectTransform>(); if (!parentRectTransform) return; Undo.RecordObject(rectTransform, "Anchor UI Object"); Rect parentRect = parentRectTransform.rect; rectTransform.anchorMin = new Vector2(rectTransform.anchorMin.x + (rectTransform.offsetMin.x / parentRect.width), rectTransform.anchorMin.y + (rectTransform.offsetMin.y / parentRect.height)); rectTransform.anchorMax = new Vector2(rectTransform.anchorMax.x + (rectTransform.offsetMax.x / parentRect.width), rectTransform.anchorMax.y + (rectTransform.offsetMax.y / parentRect.height)); rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.pivot = new Vector2(0.5f, 0.5f);