Vector3 buttonScreenPositionCamera.main.WorldToScreenPoint(_btnTagert.position);
_btnTagert.SetParent(this.transform);
_btnTagert.ResetLocalTransformation();
buttonScreenPosition *= _rectTransform.sizeDelta.x / Screen.width;
float newWidth = buttonScreenPosition.x - (_rectTransform.sizeDelta.x ) * 0.5f;
float newHeight = buttonScreenPosition.y - (_rectTransform.sizeDelta.y) * 0.5f;
_btnTagert.localPosition = new Vector3(newWidth, newHeight, 0);
[unity] canvas中世界坐标转化为本地坐标
猜你喜欢
转载自blog.csdn.net/hhh314159/article/details/130284670
今日推荐
周排行