Files
TEngine/Assets/GameScripts/HotFix/GameLogic/UI/Common/SafeTop.cs
ALEXTANG fe69c18b4e [+] UIExtension
[+] UIExtension
2023-04-13 15:35:54 +08:00

22 lines
595 B
C#

using UnityEngine;
using TEngine;
namespace GameMain
{
public class SafeTop : MonoBehaviour
{
void Start()
{
var topRect = (gameObject.transform as RectTransform);
var safeArea = UnityEngine.Screen.safeArea;
if (topRect != null)
{
var anchoredPosition = topRect.anchoredPosition;
anchoredPosition = new Vector2(anchoredPosition.x,anchoredPosition.y - safeArea.y);
topRect.anchoredPosition = anchoredPosition;
}
Log.Debug(safeArea);
}
}
}