This commit is contained in:
SoulliesOfficial
2025-06-13 14:59:58 -04:00
parent 27529d44dc
commit b9e6a9ab25
143 changed files with 7254 additions and 1906 deletions

View File

@@ -89,5 +89,15 @@ namespace Ichni
// 最后赋值 target.anchoredPosition = localPos;
return localPos;
}
/// <summary>
/// 获取目标 RectTransform 在目标空间 RectTransform 中的本地位置
/// </summary>
public static Vector2 GetLocalUIPosition(RectTransform targetRect, RectTransform targetSpace)
{
Vector2 screenPos = RectTransformUtility.WorldToScreenPoint(null, targetRect.position);
RectTransformUtility.ScreenPointToLocalPointInRectangle(targetSpace, screenPos, null, out Vector2 localPos);
return localPos;
}
}
}