Changing positions of images in code; anchoredPosition not doing anything

I have a snippet of code in my scene’s Start() method that makes some UI modifications for certain cases. It is supposed to change the y coordinate of the position of two images. The below is what I am doing based on information from other forum posts and it’s not working:

if (GameSettings.PlayerCount == 2) {
    Debug.Log("Changing positions");
    var p1CurX = playerGoingFirstImages[0].GetComponent<RectTransform>().anchoredPosition.x;
    var p2CurX = playerGoingFirstImages[1].GetComponent<RectTransform>().anchoredPosition.x;
    playerGoingFirstImages[0].GetComponent<RectTransform>().anchoredPosition.Set(p1CurX, 0);
    playerGoingFirstImages[1].GetComponent<RectTransform>().anchoredPosition.Set(p2CurX, 0);
}

The images are not bound by anchors or anything, and I’m able to move them around freely in the editor. I’ve also tried using the localPosition attribute, but the position does not want to change. Thank you in advance.

I changed lines 5 and 6 to this and it’s fine now. This thread can be deleted, sorry.

playerGoingFirstImages[0].GetComponent<RectTransform>().anchoredPosition = new Vector2(p1CurX, 0);
playerGoingFirstImages[1].GetComponent<RectTransform>().anchoredPosition = new Vector2(p2CurX, 0);