[Unity/C#] UI 위치가 원하는 대로 변경되지 않던 문제
·
Unity
GameObject button; void SwitchButton() { int xPos = -300; button.transform.position = new Vector3(xPos, button.transform.position.y, 0); } void Start() { button = GameObejct.Find("button"); SwitchButton(); } 처음에는 위와 같은 구조로 UI의 위치를 변경하려고 했는데, 이상하게 버튼이 x: -300 지점이 아닌 다른 위치로 변경되었다. 그래서 찾아보던 도중, UI는 캔버스 상에서 그려지는 것인데다가 앵커를 기준으로 좌표를 잡는다는 것을..깨달았다. 심지어 캔버스 상에 있는 오브젝트들은 transform이 아니라 rect transform을 쓰는..