/// <summary>
/// 相机
/// </summary>
public Camera m_Camera;
/// <summary>
/// UI按钮
/// </summary>
public RectTransform UIBtn;
void Update()
{
//坐标转换 世界转屏幕
Vector2 screenPoint = RectTransformUtility.WorldToScreenPoint(m_Camera, transform.position);
Vector2 localPoint;
//坐标转换 屏幕转UI
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasTran, screenPoint, m_Camera, out localPoint))
{
UIBtn.anchoredPosition = localPoint;
}
}
unit 模型的位置坐标转换到UI坐标
猜你喜欢
转载自blog.csdn.net/qiao2037641855/article/details/131060926
今日推荐
周排行