Error TS2304 Cannot find name 'WebGLObject'

Hey there, I need help with my unity setup.
I’ve got a new pc, so it’s the second time that I installed babylon.js and node.js for my unity projects.
I’ve done all steps and yes, I installed TypeScript Command and detected it in the babylon.js exporter to script compilation options.

I can’t export the project using the play button, there’s a “Build Failed” message. The errors are: “Assets/Babylon/Library/babylon.d.ts (56920,30): error TS2304: Cannot find name ‘WebGLObject’. Assets/Babylon/Library/babylon.d.ts (56926,32): error TS2304: Cannot find name ‘WebGLObject’”

and "Failed to compile project script files UnityEngine.Debug:LogError(Object)

The problem is in existing projects and also in new unity projects.
I’m working with Unity 2019.3.9f1, Babylon Toolkit Version 4.0.0 and I installed node.js 14.17.0 LTS.

Can anyone help?

I think your problem is similar to Vite + Rollup production build "TS2304: Cannot find name 'WebGLObject'"
Hope it will help :slight_smile:


I think this is a TypeScript issue… I think they took out WebGLObject in TypeScript 4.3… Try installing

npm install -g typescript@4.0.2 on your machine.

BTW… that version of the Toolkit and Unity Editor 2019 is no longer supported.
You should be using the new GLTF based toolkit which requires Unity 2020.1 Or Greater. I might not be able to help issues in the old toolkit.

Also i think the newer babylon.d.ts does not use WebGLObject anymore. @Deltakosh was gonna get rid of that… I think

already done :wink: