# colorShader and colorShaderOccQuery kept after serialize

**URL:** <https://forum.babylonjs.com/t/colorshader-and-colorshaderoccquery-kept-after-serialize/36870>\
**Category:** Bugs\
**Tags:** material, sceneserializer, serialization, serializer, boundingbox\
**Created:** [December 26, 2022, 2:27am UTC](https://forum.babylonjs.com/t/colorshader-and-colorshaderoccquery-kept-after-serialize/36870 "2022-12-26T02:27:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kzhsw](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kzhsw](https://forum.babylonjs.com/u/kzhsw)\
**Post date:** [December 26, 2022, 2:27am UTC](https://forum.babylonjs.com/t/colorshader-and-colorshaderoccquery-kept-after-serialize/36870/1 "2022-12-26T02:27:18Z")

</div>

OS: Windows 10 x64  
Browser: ungoogled-chromium 108.0.5359.95  
Babylon.js: 5.39.0  
Playground: [https://playground.babylonjs.com/#E9EBSL#1](https://playground.babylonjs.com/#E9EBSL#1)

Open the inspector and expend the materials.

Expected:  
The colorShader and colorShaderOccQuery should be excluded from serialization and not being loaded again.  
Referring to [BABYLON.ShaderMaterial#doNotSerialize](https://doc.babylonjs.com/typedoc/classes/BABYLON.ShaderMaterial#doNotSerialize)

Actual:  
The colorShader and colorShaderOccQuery is serialized and loaded, and never reused again.

![图片](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/7/7/7719e44f6f8988554efe2f525054f5fc4b23c7a6.png)

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [December 26, 2022, 10:30am UTC](https://forum.babylonjs.com/t/colorshader-and-colorshaderoccquery-kept-after-serialize/36870/2 "2022-12-26T10:30:31Z")

</div>

The two shaders used by the bounding box renderer are not flagged as `doNotSerialize`. If you don’t want to serialize them, you can set `doNotSerialize=true`:

> **[Babylon.js Playground](https://playground.babylonjs.com/#E9EBSL%234)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

[EDIT] You’re right, though, that we should not serialize them in the first place, so here’s the PR:

> <https://github.com/BabylonJS/Babylon.js/pull/13379>
>
> See https://forum.babylonjs.com/t/colorshader-and-colorshaderoccquery-kept-after…-serialize/36870
> 
> We should not serialize those materials as they will be recreated automatically when needed.
