Hello, before this code worked, now not more, any idea why?
Game.prototype.daynight= function() {
this.timestart=Date.now();
if (this.hour==='day') {
this.hour='night';
this.cubenight.loadFaces = true;
this.app.scene.skybox=this.cubenight.resource;
this.app.scene.skyboxIntensity=0.3;
this.app.scene.fogColor=new pc.Color(0,0,0);
this.app.scene.fog='linear';
this.app.scene.skyboxMip = 1;
this.light.light.color= new pc.Color(0,0.1,0.3);
var lamp=this.app.root.findByTag('light');
var lamp1=this.app.root.findByTag('lamp');
for (var i=0; i<lamp.length;i++) {
lamp[i].light.enabled=true;
lamp1[i].model.model.meshInstances[7].material = this.texLamp[1].resource;
}
this.app.lightmapper.bake(null, pc.BAKE_COLORDIR);
} else {
this.hour='day';
this.cubemap.loadFaces = true;
this.app.scene.skybox=this.cubemap.resource;
this.app.scene.skyboxIntensity=1;
this.app.scene.fogColor=new pc.Color(0.3,0.4,0.5);
this.app.scene.skyboxMip = 1;
this.light.light.color= new pc.Color(0.7,0.7,0.7);
var lamp=this.app.root.findByTag('light');
var lamp1=this.app.root.findByTag('lamp');
for (var i=0; i<lamp.length;i++) {
lamp[i].light.enabled=false;
lamp1[i].model.model.meshInstances[7].material = this.texLamp[0].resource;
}
this.app.lightmapper.bake(null, pc.BAKE_COLORDIR);
}
};