Using skybox only for environment map


I have many metallic materials with ‘useSkybox:true’ in the JSON already and I don’t want to show the skybox in my scene but want to use it only in the materials for their environment map. Is there any way to hide the skybox in the scene but use only for materials? It’s because I have the JSONs already and it’s hard to change ‘useSkybox:true’.

Yes, just remove the cubemap from the Scene Settings to not show a skybox. And then multiselect the materials you want to reflect the cubemap and assign it to the ENVIRONMENT -> Cube Map slot in the Inspector:


I meant ‘in code’.
So, I could remove the current skybox from the scene by
Before removing it I save its reference so that I can use:
mymesh.material.cubeMap = savedSkybox;

But, no luck for either doing mymesh.material.useSkybox = false or true.

Any idea?

Thank you,

In my project i have marked all relevant material with a tag, and searched for it:

const mats = app.assets.findByTag('gi');
mats.forEach((mat) => {
  mat.cubeMap = this.asset.resource;     

you could also search for special names, or just iterate over any material.