# Default options parameter for Create functions

**URL:** https://forum.babylonjs.com/t/default-options-parameter-for-create-functions/25124
**Category:** Feature requests
**Created:** [November 9, 2021, 7:23pm UTC](https://forum.babylonjs.com/t/default-options-parameter-for-create-functions/25124 "2021-11-09T19:23:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)
#### Post date: [November 9, 2021, 7:23pm UTC](https://forum.babylonjs.com/t/default-options-parameter-for-create-functions/25124/1 "2021-11-09T19:23:43Z")

</div>

Heya, I was wondering if the options parameter could default to an empty object for CreateBox and the other Create functions?

Currently for example, calling CreateBox without any parameters throws an error because CreateBox attempts to access properties of the undefined options parameter.

But after defaulting the options parameter to {} like below, then the box mesh is created without error with default options.

```auto
export function CreateBox(name: string, options: { size?: number, width?: number, height?: number, depth?: number, faceUV?: Vector4[], faceColors?: Color4[], sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, wrap?: boolean, topBaseAt?: number, bottomBaseAt?: number, updatable?: boolean } = {}, scene: Nullable<Scene> = null): Mesh {

```

If sounds good, I’m happy to make a PR for the Create functions. 🙂

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [November 9, 2021, 7:45pm UTC](https://forum.babylonjs.com/t/default-options-parameter-for-create-functions/25124/2 "2021-11-09T19:45:51Z")

</div>

sounds good to me

---

<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: [November 9, 2021, 8:22pm UTC](https://forum.babylonjs.com/t/default-options-parameter-for-create-functions/25124/3 "2021-11-09T20:22:33Z")

</div>

I always forget the options parameter so this sounds wonderful to me. 😂

---

<div class="post-metadata">

### Author: ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)
#### Post date: [November 9, 2021, 9:16pm UTC](https://forum.babylonjs.com/t/default-options-parameter-for-create-functions/25124/4 "2021-11-09T21:16:23Z")

</div>

Here’s the patch: I updated and tested all of the Create functions listed under the Methods section of the Mesh documentation that don’t have any required options and didn’t have a default options object already. 🙂 🍻

```auto
CreateBox
CreateCylinder
CreateDisc
CreateGround
CreateGroundFromHeightMap
CreateHemisphere
CreateIcoSphere
CreatePlane
CreatePolyhedron
CreateSphere
CreateTorus
CreateTorusKnot

```

> <https://github.com/BabylonJS/Babylon.js/pull/11421>
>
> Add default options parameter, {}, for Create functions that don’t have any req…uired options and don’t have a default options object already.
> 
> Forum:
