12345678910111213141516 |
- using UnityEngine;
- namespace Plugins.CxShine.SafeArea
- {
- public class SafeAreaBottom : MonoBehaviour
- {
- public void Start()
- {
- //计算屏幕顶部异形大小
- var safeAreaOffset = (int)(Screen.height - Screen.safeArea.yMax);
- //UI偏移
- var rectTransform = transform.GetComponent<RectTransform>();
- rectTransform.offsetMax = new Vector2(0, -safeAreaOffset);
- }
- }
- }
|