javaScript改变skybox

var dayMaterial:Material;
var nightMaterial:Material;
private var ButtonText:String ="day";
RenderSettings.skybox = dayMaterial;

function OnGUI () {
    if (GUI.Button (Rect (10,10,150,50), ButtonText)) {
            if (RenderSettings.skybox == dayMaterial){
                ButtonText = "night";
                RenderSettings.skybox= nightMaterial;
            }else if(RenderSettings.skybox == nightMaterial){
                ButtonText = "day";
                RenderSettings.skybox= dayMaterial;
            }
    }
}

你可能感兴趣的:(JavaScript)