Property 'createDefaultEnvironment' does not exist on type 'Scene'

Property ‘createDefaultEnvironment’ does not exist on type ‘Scene’.

Project type: TypeScript

import { Scene } from “@babylonjs/core/scene”;

this.scene.createDefaultEnvironment({
environmentTexture: hdrTexture
})

The method doesn’t exist on the the scene from core/scene, is there another scene import I should be using?

According to API Docs, it’s listed:

import “@babylonjs/core/Helpers/sceneHelpers”;

Used UltraEdit to search through gitrepo download for createDefaultEnvironment function, once found I then imported that file…

Why does babylon work this way?

1 Like

This is the only way we had to support tree shaking quickly without breaking backward compat but still at a decent tree shaking ratio :frowning:

@RaananW is evaluating a different approach for all this.

Don’t suppose you know which file to include for scene.activeCamera as my search is finding it in many many files but getting error activeCamera is not a property or does not exist…

activeCamera is part of scene without any needs for external modules.

This is really strange is would not be available.