How to use our own configuration for babylon viwer

i want to creating configuration at runtime,i have created by own configuration using ViewerConfiguration., now how to update the configuration to viewer, when i use updateConfiguration under viewer.onEngineInitObservable.add. it throws error at runtime, can you point to how to do it

invoking the Viewer Overlord @RaananW ;D

Hey,

Would you be able to show a (non) working example so I can see the issue and how you are using it?

I would suggest waiting for the viewer to initialize before updating the configuration. the updateConfigurstion function expects the scene to already be initialized, which is not the case in the onEngineInit. But this is just a guess, seeing some code in action would help a lot

BabylonViewer.InitTags(“customViewer”);

BabylonViewer.viewerManager.getViewerPromiseById(‘renderCanvas’).then(function (viewer) {
viewer.onEngineInitObservable.add(function (scene) {
viewer.updateConfiguration(customConfiguration);

}); 

});

yeah, as I wrote - this would be the wrong time to update the configuration, as the scene is not yet constructed and the configuration will not be updated correctly.

You can add that as an issue in github, I will probably delay the update configuration call until everything is ready. But what you can do until then is either pass the configuration dynamically : Configuring The Viewer - Babylon.js Documentation , or disable auto-init entirely and initialzed the viewer using the right configuration:

https://doc.babylonjs.com/extensions/configuring_the_viewer#configuring-using-javascript

Or, if you want to keep on using your code, use the onViewerAddedObservable instead of engine-init