com.alicizax.unity/Runtime/Extension/UnityEngine.Transform/UnityEngine.UIExtension.cs
2025-02-11 19:12:14 +08:00

28 lines
888 B
C#

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;
}
}
}