[SOLVED] Changing HDRI/cubemap/skybox script

Hi everyone,

Is it possible to change the skybox in runtime? I have found ways of managing cubemaps but not for adding them to the sky. Do someone know how to do this?

Thank you a lot

Hi @practicas_imas,

You can set your skybox cubemaps at any point using the following method:

https://developer.playcanvas.com/api/pc.Scene.html#setSkybox

It’s available on the active scene:

this.app.scene.setSkybox(this.cubemap.resources);
1 Like

where is that “this.cubemap.resources” assigning an specific cubemap? it is

this.cubemap.resources.*NAMEOFTHECUBEMAP*

you have to assign it as an attribute? or is it another thing?

So this.cubemap is a cubemap asset and resources is the property you need to pass.

Yup, it worked

Thank you!

1 Like