# There is now way to get the EngineOptions from an engine

**URL:** <https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357>\
**Category:** Questions\
**Created:** [December 29, 2021, 7:23pm UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357 "2021-12-29T19:23:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmitov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kmitov/32/4969_2.png) [@kmitov](https://forum.babylonjs.com/u/kmitov)\
**Post date:** [December 29, 2021, 7:23pm UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/1 "2021-12-29T19:23:09Z")

</div>

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

> **[EngineOptions | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/interfaces/babylon.engineoptions)**
>
> Interface defining initialization parameters for Engine class \[API\]

For some of the options like “stencil” there is an “is” method in the engine. We can call isStencilEnabled - [Engine | Babylon.js Documentation](https://doc.babylonjs.com/typedoc/classes/babylon.engine#isstencilenable)

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

```auto
engine._creationOptions

```

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?

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [January 3, 2022, 11:38am UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/2 "2022-01-03T11:38:15Z")

</div>

Yeah, it’s private/protected: [Babylon.js/thinEngine.ts at master · BabylonJS/Babylon.js (github.com)](https://github.com/BabylonJS/Babylon.js/blob/master/src/Engines/thinEngine.ts#L348)

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?

---

<div class="post-metadata">

**Author:** ![kmitov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kmitov/32/4969_2.png) [@kmitov](https://forum.babylonjs.com/u/kmitov)\
**Post date:** [January 6, 2022, 7:08am UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/3 "2022-01-06T07:08:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 4, 2022, 4:47pm UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/4 "2022-02-04T16:47:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [February 4, 2022, 5:01pm UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/5 "2022-02-04T17:01:46Z")

</div>

I see no problem 🙂

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 7, 2022, 11:34am UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/6 "2022-02-07T11:34:16Z")

</div>

Sorry for the delay, PR is up! [https://github.com/BabylonJS/Babylon.js/pull/11924](https://github.com/BabylonJS/Babylon.js/pull/11924)

---

<div class="post-metadata">

**Author:** ![kmitov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kmitov/32/4969_2.png) [@kmitov](https://forum.babylonjs.com/u/kmitov)\
**Post date:** [February 14, 2022, 9:13am UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/7 "2022-02-14T09:13:49Z")

</div>

Thanks @carolhmj . Exactly what we need. This is only on [preview.babylonjs.com](http://preview.babylonjs.com), 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

---

<div class="post-metadata">

**Author:** ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)\
**Post date:** [February 14, 2022, 3:57pm UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/8 "2022-02-14T15:57:43Z")

</div>

Lemme ask @RaananW 😃

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [February 14, 2022, 8:08pm UTC](https://forum.babylonjs.com/t/there-is-now-way-to-get-the-engineoptions-from-an-engine/26357/9 "2022-02-14T20:08:36Z")

</div>

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