[+] UIExtension

[+] UIExtension
This commit is contained in:
ALEXTANG
2023-04-13 15:35:54 +08:00
parent 7a80f79b16
commit fe69c18b4e
8 changed files with 214 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
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);
}
}
}