Error when try to create via script a pbr material on the babylon editor

Hello,
I’m just trying to create a new PBR material on the babylon editor.
I’m using this code:

var test = new PBRMaterial(“test”,this._scene);

but when I go to play nothing happens and the console goes into error:

“brdfTextureTools.js:15 Uncaught TypeError: Cannot read property ‘environmentBRDFTexture’ of undefined”

Someone can help me?What is this property and why is not readable?
thanks a lot.

This means scene is undefined in your parameters I d guess but a repro in the playground would definitely help ?

1 Like

Hello,
Thanks for the reply.
I tried to change the script extension type from:

export default class MyScript extends Node{}
to:
export default class MyScript extends Scene {}

and finally it work. Realy sorry for noob question.

I don’t know yet why first with a Node extention the parameter “this._scene.environmentBRDFTexture” was not readable, while yet witha Scene extention yes as “this.environmentBRDFTexture”.
But now it work, that is fine for me :smiley:

thank you a lot again.
regards.

1 Like