There is now way to get the EngineOptions from an engine

When constructing an Engine we can specify a number of options:

For some of the options like “stencil” there is an “is” method in the engine. We can call isStencilEnabled - Engine | Babylon.js Documentation

I was able to find a get method for this option and for a few of the others. But I could not find a method for all the options.

Here is our use case and there reason why we need it.

In our buildin3d platform we call new BABYLON.Engine in one place. Different extensions provide the options for the engine. The Screenshot extension provides the option preserveDrawingBuffer which is not needed otherwise if the Screenshot extension is not enabled.

This means that there is logic for calling new BABYLON.Engine(). We would like to test this logic. In order to test this logic a new engine is created in the production code and in the spec we would like to inspect the options that were used for creation of this engine.

There is


which I assume is private.

Is there a way we could access _creationOptions in a public way? Is there a chance for such a way to be introduced to make it possible to spec the engine creations?

Yeah, it’s private/protected: Babylon.js/thinEngine.ts at master · BabylonJS/Babylon.js (

For your specific use case, there’s a way to do that without needing to look into the Babylon Engine. You could store the options object in a variable, pass that to the engine, and then in your spec check that same object. Would that be possible in your system?

I could. It introduces some inconsistency and there is a logic that could never be speces in this way - specifically that we’ve passed the right options to the engine.

I could use the _createOptions. It would be great if ther is a consistent API for all the create options. Some of them have public get methods, some of them don’t. Even a getCreatedOptions() would be greate.

@Deltakosh @sebavan do you think we could add getCreationOptions ?

1 Like

I see no problem :slight_smile:


Sorry for the delay, PR is up!

Thanks @carolhmj . Exactly what we need. This is only on, right? When do you think it will be on cdn?

I am asking because we are running cdn specs everday and preview specs ones a week and just to know when it will switch

Lemme ask @RaananW :smiley:

I will be building anew package tomorrow, so you will have it available in npm tomorrow as well.

1 Like