【Unity】RectTransform : localPosition, positionは違うもの
localPosition、positionは別物。
public void LeftControl(){ ForceButton.gameObject.GetComponent<RectTransform>().localPosition = DefaultPosForceButton; } public void RightControl(){ // localPositionと記述してあげなければ、グローバルな場所になる。 ForceButton.gameObject.GetComponent<RectTransform>().localPosition = new Vector3(300f, -140f, 0f); // 別物! ForceButton.gameObject.GetComponent<RectTransform>().position = new Vector3(300f, -140f, 0f); }