This commit is contained in:
陈思海 2025-02-11 19:12:14 +08:00
parent 0073cf807f
commit 0c7d6df5ee
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,27 @@
namespace UnityEngine
{
[UnityEngine.Scripting.Preserve]
public static class UnityEngine_UIExtension
{
//重置为全屏自适应UI
public static void ResetToFullScreen(this RectTransform self)
{
self.anchorMin = Vector2.zero;
self.anchorMax = Vector2.one;
self.anchoredPosition3D = Vector3.zero;
self.pivot = new Vector2(0.5f, 0.5f);
self.offsetMax = Vector2.zero;
self.offsetMin = Vector2.zero;
self.sizeDelta = Vector2.zero;
self.localEulerAngles = Vector3.zero;
self.localScale = Vector3.one;
}
//重置位置与旋转
public static void ResetLocalPosAndRot(this RectTransform self)
{
self.localPosition = Vector3.zero;
self.localRotation = Quaternion.identity;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 56352ccd99c4451e8356690eff9b1e90
timeCreated: 1739263302