# colorShader kept and not reused after serialization of LinesMesh

**URL:** <https://forum.babylonjs.com/t/colorshader-kept-and-not-reused-after-serialization-of-linesmesh/36871>\
**Category:** Bugs\
**Tags:** material, sceneserializer, serialization, serializer\
**Created:** [December 26, 2022, 2:34am UTC](https://forum.babylonjs.com/t/colorshader-kept-and-not-reused-after-serialization-of-linesmesh/36871 "2022-12-26T02:34:58Z")\
**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:34am UTC](https://forum.babylonjs.com/t/colorshader-kept-and-not-reused-after-serialization-of-linesmesh/36871/1 "2022-12-26T02:34:58Z")

</div>

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

Open the inspector and expend the materials.

Expected:  
The colorShader material should be excluded from serialization or reused after load.  
Referring to [BABYLON.ShaderMaterial#doNotSerialize](https://doc.babylonjs.com/typedoc/classes/BABYLON.ShaderMaterial#doNotSerialize)

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

Similar:

> [@colorShader and colorShaderOccQuery kept after serialize](https://forum.babylonjs.com/t/colorshader-and-colorshaderoccquery-kept-after-serialize/36870):
>
> 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. [图片]

---

<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:36am UTC](https://forum.babylonjs.com/t/colorshader-kept-and-not-reused-after-serialization-of-linesmesh/36871/2 "2022-12-26T10:36:41Z")

</div>

Fixed in the same PR than:

> [@colorShader and colorShaderOccQuery kept after serialize](https://forum.babylonjs.com/t/colorshader-and-colorshaderoccquery-kept-after-serialize/36870/2):
>
> 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: [EDIT] You’re right, though, that we should not serialize them in the first place, so here’s the PR:
