using UnityEngine;

public sealed class SafeArea : MonoBehaviour {

    void Start(){
        var safeAreaTransform = (RectTransform)transform;
        var safeArea = Screen.safeArea;
        var anchorMin = safeArea.position;
        var anchorMax = safeArea.position + safeArea.size;
        anchorMin.x /= Screen.width;
        anchorMin.y /= Screen.height;
        anchorMax.x /= Screen.width;
        anchorMax.y /= Screen.height;
        safeAreaTransform.anchorMax = anchorMax;
        safeAreaTransform.anchorMin = anchorMin;
    }
}
