using UnityEngine; using UnityEngine.UI; public class BarResizer : MonoBehaviour { protected void Start () { HorizontalLayoutGroup barBottomLayout = gameObject.GetComponent(); if (Screen.dpi < 140) { barBottomLayout.spacing = 22; } // 240 else if (Screen.dpi < 280) { barBottomLayout.spacing = 44; } // 320 else if (Screen.dpi < 400) { barBottomLayout.spacing = 80; } // 480 else if (Screen.dpi < 500) { barBottomLayout.spacing = 92; } else { barBottomLayout.spacing = 80; } } }