Changing skybox using GUI button

I would like to make it so that my game has three different skybox options and when you click a GUI button it changes the skybox to the skybox material you chose. Is this possible?

var sky1 : Material;
var sky2 : Material;
var sky3 : Material;

function OnGUI () {

if(GUILayout.Button ("Sky 1"))
{
   RenderSettings.skybox = sky1;
}

if(GUILayout.Button ("Sky 2"))
{
   RenderSettings.skybox = sky2;
}

if(GUILayout.Button ("Sky 3"))
{
   RenderSettings.skybox = sky3;
}

}