Babylonjs unity - Build project error

Hi , I am new to Babylon.js . I am following this tutorial.Link. I am stuck at the point where we build our project. I also install typescript. using cmd: npm install -g typescript.

Currently getting this error:

Assets/[Babylon]/Template/Typings/babylon.d.ts(45128,32): error TS2304: Cannot find name ‘XMLHttpRequestBodyInit’.
Assets/[Babylon]/Template/Typings/babylon.d.ts(92243,13): error TS2403: Subsequent variable declarations must have the same type. Variable ‘VRFrameData’ must be of type ‘{ new (): VRFrameData; prototype: VRFrameData; }’, but here has type ‘any’.
Assets/[Babylon]/Template/Typings/babylon.manager.d.ts(1305,11): error TS2300: Duplicate identifier ‘TouchJoystickHandler’.
Assets/Content/Browser/InputController.ts(1737,19): error TS2300: Duplicate identifier ‘TouchJoystickHandler’.
Assets/Content/Loader/AssetPreloader.ts(29,99): error TS2339: Property ‘RegisterImportMeshes’ does not exist on type ‘typeof SceneManager’.
Assets/Content/Loader/AssetPreloader.ts(42,103): error TS2339: Property ‘RegisterAssetContainer’ does not exist on type ‘typeof SceneManager’.
node_modules/@types/node/index.d.ts(179,11): error TS2300: Duplicate identifier ‘IteratorResult’.
node_modules/typescript/lib/lib.es2015.iterable.d.ts(41,6): error TS2300: Duplicate identifier ‘IteratorResult’.

System.UnityTools:CompileProjectScriptBundle (System.IO.StreamWriter,string,string,string,string,bool,string)
CanvasTools.CanvasToolsExporter:ExportProject (string,EditorSceneInformation,EditorBuildType,UnityEngine.Transform,string,string)
CanvasTools.CanvasToolsExporter:BuildProject (EditorBuildType,UnityEngine.Transform,string,string)
CanvasTools.CVPanel:OnGUI ()
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Need assistance pls.

Welcome aboard!

(I moved your thread in a more appropriate category).

Maybe @MackeyK24 can help you as he is the father of the Unity to Babylon toolkit, but you may have to be patient as we are on vacation days.

Sure, Meanwhile I shall try to find more options for this error. Let me know if we have any series of tutorials for Babylon scripting in unity as well. Thanks

cc @MackeyK24 for visibility

1 Like

You need to match the TypeScript version to the the Babylon Version you are building…

So either try update your global typescript:

npm -i g typescript

of run the local npm install in the root of your project like it says in the script compiler section of the exporter panel

npm install
2 Likes

How can I check on VR headset while running on localhost?
Can I directly build from unity exporter to VR Device?

Hi! Was Your Problem solved?
I tried through MackeyK24’s solution.
The following error:
Assets/[Babylon]/Template/Typings/babylon.manager.d.ts(1305,11): error TS2300: Duplicate identifier ‘TouchJoystickHandler’.
Assets/Content/Browser/InputController.ts(1737,19): error TS2300: Duplicate identifier ‘TouchJoystickHandler’.
Assets/Content/Loader/AssetPreloader.ts(29,99): error TS2339: Property ‘RegisterImportMeshes’ does not exist on type ‘typeof SceneManager’.
Assets/Content/Loader/AssetPreloader.ts(42,103): error TS2339: Property ‘RegisterAssetContainer’ does not exist on type ‘typeof SceneManager’.
still exist!

Yes now you are one step closer. Try to comment the code where it shows the error.
Try to comment ‘TouchJoystickHandler’ code in InputContoller.ts
And comment error code in AssetPreloder.ts .
Hopefully it will resolve the issue.

I applied these settings and my project was running fine.

2 Likes

Thanks a lot!
I have solved the problem and marked on my topic

My solution is exactly what you said.
Thanks again!

1 Like