public int minx, miny, maxx, maxy;
/// <summary>
/// 移动限制窗口
/// </summary>
/// <param name="originTrans">当前需要移动的节点</param>
public void RestrictMoveInWindow(RectTransform originTrans)
{
Vector3 pos = originTrans.localPosition;
pos.x = Mathf.Clamp(originTrans.localPosition.x, minx, maxx);
pos.y = Mathf.Clamp(originTrans.localPosition.y, miny, maxy);
originTrans.localPosition = pos;
}
移动限制窗口
最新推荐文章于 2022-06-23 17:44:18 发布