I’m trying to change the skybox of the scene, but it doesn’t seem to be working. I have set an initial skybox from the editor, and I try to change it from this script:
var SkyboxUpdater = pc.createScript('skyboxUpdater');
SkyboxUpdater.attributes.add("cubemap", { type:"asset", assetType:"cubemap" });
// initialize code called once per entity
SkyboxUpdater.prototype.initialize = function()
{
var div = document.createElement("div");
var button = document.createElement("button");
button.style = "position:fixed; top:0px; left:0px; width:100px; height:30px";
button.innerHTML = "Test";
button.addEventListener("click", onClick.bind(this));
div.appendChild(button);
document.body.appendChild(div);
};
function onClick()
{
console.log(this.cubemap.resource);
this.app.scene.skybox = this.cubemap.resource;
}
But the only thing I get is a black background, and the objects’ materials that should be affected by the skybox don’t change their appearance: https://playcanvas.com/project/434733/overview/skybox-test