Vector3 upWallPosition = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width / 2, Screen.height));
upWall.transform.position = upWallPosition;
float width = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height)).x * 2;
upWall.size = new Vector2(width, 1);
2D游戏案例,写了这段代码,也抄了一遍,都发现错误。无法把上面的upWall设置全覆盖,只有中间一小块的是有upWall。但是位置在y的位置都设置对了。就是x没有扩大。能检查下代码的错误并且给下解决方案吗?