Different results setting cubemap face via a script than through the editor

I have a script that dynamically loads a cubemap face from a set of textures using the SetPixels method as shown below. I am using 24-bit RGB textures with their read/write flag set.

The script works, though the results are very different to what I see when I manually select cubemap faces through the editor (even if I select the same texture as my script). The cubemap generated by the script is either completely corrupt or all the faces are upside down. Is there an additional conversion step the editor is doing I can do in my script?

public class ReloadCubeMap : MonoBehaviour {
	public Cubemap cm; 
	public Texture2D top;
	public Texture2D bottom;
	public Texture2D front;
	public Texture2D back;
	public Texture2D left;
	public Texture2D right;
	

	void OnGUI() {
		if (Event.current.Equals(Event.KeyboardEvent("r")))
		{
	        Color[] faceColors;
	        faceColors = top.GetPixels();
	        cm.SetPixels(faceColors, CubemapFace.PositiveY);			
	        faceColors = bottom.GetPixels();
	        cm.SetPixels(faceColors, CubemapFace.NegativeY);		
	        faceColors = front.GetPixels();
	        cm.SetPixels(faceColors, CubemapFace.PositiveZ);		
	        faceColors = back.GetPixels();
	        cm.SetPixels(faceColors, CubemapFace.NegativeZ);		
	        faceColors = right.GetPixels();
	        cm.SetPixels(faceColors, CubemapFace.PositiveX);		
	        faceColors = left.GetPixels();
	        cm.SetPixels(faceColors, CubemapFace.NegativeX);		
			cm.Apply();
		}
	}
}

I got stuck at exactly the same places. The solution I found for the two issues mentioned were:

1.) “Corrupt” images - make sure the source Texture2Ds all have the same width/height. Cubemap faces need to be square!
2.) I don’t understand why, but it seems that you need to manually flip/mirror (can never remember which one is which) the pixels about the x axis, which you can do in a function like this:

	Texture2D Flip(Texture2D sourceTex) {
		// Create a new Texture2D the same dimensions and format as the input
		Texture2D Output = new Texture2D(sourceTex.width, sourceTex.height, sourceTex.format);
		// Loop through pixels
		for (int y = 0; y < sourceTex.height; y++)
        {
            for (int x = 0; x < sourceTex.width; x++)
            {
				// Retrieve pixels in source from left-to-right, bottom-to-top
				Color pix = sourceTex.GetPixel(sourceTex.width + x, (sourceTex.height-1) - y);
				// Write to output from left-to-right, top-to-bottom
				Output.SetPixel(x, y, pix);
            }
        }
		return Output;
	}

I’m in the middle of writing up a blog post with my complete code (I was trying to render cubemap faces dynamically rather than from assigned Textures in the inspector) - I’ll post a link back here when it’s up.